summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xssh_hack15
1 files changed, 9 insertions, 6 deletions
diff --git a/ssh_hack b/ssh_hack
index 1af4f7c..cac6623 100755
--- a/ssh_hack
+++ b/ssh_hack
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
### we need to export each of the query string variables
### then send them over ssh
-q="$(printf "%s\n" "$1" | uricut -q)"
-p="$(printf "%s\n" "$1" | uricut -p)"
-d="$(printf "%s\n" "$1" | uricut -d)"
-P="$(printf "%s\n" "$1" | uricut -P)"
-u="$(printf "%s\n" "$1" | uricut -u)"
+uri="$1"
+q="$(printf "%s\n" "$uri" | uricut -q)"
+p="$(printf "%s\n" "$uri" | uricut -p)"
+d="$(printf "%s\n" "$uri" | uricut -d)"
+P="$(printf "%s\n" "$uri" | uricut -P)"
+u="$(printf "%s\n" "$uri" | uricut -u)"
eval "$(printf '%s\n' "$q" | tr '&' ' ' | grep '[^ ]*=' | sed 's/^/export /g')"
if [ "$p" ];then
@@ -18,8 +19,10 @@ if [ "$u" ];then
HACK_USER="$u@"
fi
+set_terminal_title "$uri"
+
if [ "$q" ];then
-tmpfile=$(mktemp);
+ tmpfile=$(mktemp);
printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g' > "$tmpfile"
ssh -F "$tmpfile" -t ${HACK_PORT} ${HACK_USER}${d} ${p:1}
else