#!/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)" 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 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} #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}