blob: cac6623e4601f1877f747e76d543ba026a09e6fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env bash
### we need to export each of the query string variables
### then send them over ssh
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
p="$(uriunescape "$p")"
fi
if [ "$P" ]; then
HACK_PORT="-p $P"
fi
if [ "$u" ];then
HACK_USER="$u@"
fi
set_terminal_title "$uri"
if [ "$q" ];then
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
ssh -t ${HACK_PORT} ${HACK_USER}${d} ${p:1}
fi
#ssh -F <(printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g') -t ${HACK_PORT} ${HACK_USER}${d} ${p:1}
#ssh -F <(printf '%s\n' "$q" | tr '&' '\n' | cut -d= -f1 | sed 's/^/SendEnv /g') -t ${HACK_PORT} ${HACK_USER}${d} ${p:1}
|