Commit 0e223aa2 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Make .ssh/forward call .ssh/ssh by path

`.ssh/forward`, being a script, does not expand aliases so needs to
call `.ssh/ssh` directly.
parent 0572a2c3
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
#!/bin/sh
has(){ type $1 >/dev/null 2>/dev/null; }

SSH_DIR=`dirname $0`
HOST=$1
PORT=$2

set $SSH_DIR/ssh -W $1:$2 $3

for PYTHON in python3.7 python3.6 python3.5 python3.4 python3.3 python3 \
	python2.7 python2 python
do
@@ -11,9 +17,9 @@ done

if ! has $PYTHON; then
	echo >&2 "No python found, falling back immediately to SSH proxy"
	exec ssh -W $1:$2 $3
	exec "$@"
fi

# First two args: host & port
# Subsequent args: fallback command
exec ${PYTHON} `dirname $0`/connect.py $1 $2 ssh -W $1:$2 $3
exec ${PYTHON} $SSH_DIR/connect.py $HOST $PORT "$@"