summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2016-10-22 18:20:12 +0200
committerJonas Smedegaard <dr@jones.dk>2016-10-22 19:02:54 +0200
commitdbc7fe7a5710bdd93d467ed11b9044949463d4a0 (patch)
treecad7c244a019252f27bea6f0528818187dbf7362
parent4f9e5c3017f69ba01608a5b9371cb736bc61bf0c (diff)
Apply ssh options directly.
-rwxr-xr-xxsh11
1 files changed, 5 insertions, 6 deletions
diff --git a/xsh b/xsh
index 630709c..74d32a9 100755
--- a/xsh
+++ b/xsh
@@ -25,15 +25,14 @@ SUDO=''
X=''
V=''
HOST=''
-ssh_opts="-t"
-
+PORT=''
while [ $# -gt 0 ]; do
case $1 in
su) SU=1; SUDO=;;
sudo) SUDO=1; SU=;;
- --x|-x|x) X=1; ssh_opts="$ssh_opts -X";;
- --verbose|-v) V=1; ssh_opts="$ssh_opts -v";;
- --port|-p) ssh_opts="$ssh_opts -p $2"; shift;;
+ --x|-x|x) X=1;;
+ --verbose|-v) V=1;;
+ --port|-p) PORT="$2"; shift;;
--) shift; break;;
-*) usage; exit 1;;
@*) HOST=${1#@};;
@@ -54,6 +53,6 @@ done
# FIXME: needs shell wrapper (provided by SSH but not in local use)
[ -z "$V" ] || set -- "$@"\; sleep 4
-[ -z "$HOST" ] || set -- ssh $ssh_opts $HOST "$@"
+[ -z "$HOST" ] || set -- ssh -t${X:+ -X}${V:+ -v}${PORT:+ -p "$PORT"} $HOST "$@"
termwrapper "$@"