diff options
author | Jonas Smedegaard <dr@jones.dk> | 2016-10-22 11:47:46 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2016-10-22 11:47:46 +0200 |
commit | a2ed2aef83fa22052bec2b5e07ec85fec990fe78 (patch) | |
tree | bcc01cd9bb1f9aaed10d020f9a9b7caaf3a78c5d /xsh | |
parent | 614db395e5972866f404fe411e639e457e9bd556 (diff) |
Change logic: Prepend @ to indicate host (bare word is now always command).
Diffstat (limited to 'xsh')
-rwxr-xr-x | xsh | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |