From a2ed2aef83fa22052bec2b5e07ec85fec990fe78 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sat, 22 Oct 2016 11:47:46 +0200 Subject: Change logic: Prepend @ to indicate host (bare word is now always command). --- xsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'xsh') diff --git a/xsh b/xsh index 2f265ba..67b8edf 100755 --- a/xsh +++ b/xsh @@ -3,7 +3,7 @@ SCRIPT=$(basename $0) usage() { - echo "Usage: $SCRIPT [--x] [--verbose] [[su|sudo] [{user}@]{host}] [-- command...]" + echo "Usage: $SCRIPT [--x] [--verbose] [su|sudo] [[{user}]@{host}] [[--] command...]" } termwrapper() { @@ -42,7 +42,8 @@ while [ $# -gt 0 ]; do --port|-p) ssh_opts="$ssh_opts -p $2"; shift;; --) shift; break;; -*) usage; exit 1;; - *) [ -z "$HOST" ] && HOST=$1 || break;; + *@*|@*) HOST=$1;; + *) break;; esac shift done @@ -88,6 +89,9 @@ case "$HOST" in termwrapper $prg fi ;; + @*) + HOST=$(echo "$HOST" | sed 's/^@//') + ;;& *) if [ -n "$SU" ]; then termwrapper ssh $ssh_opts $HOST $prg_su -- cgit v1.2.3