summaryrefslogtreecommitdiff
path: root/xsh
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2016-10-22 11:47:46 +0200
committerJonas Smedegaard <dr@jones.dk>2016-10-22 11:47:46 +0200
commita2ed2aef83fa22052bec2b5e07ec85fec990fe78 (patch)
treebcc01cd9bb1f9aaed10d020f9a9b7caaf3a78c5d /xsh
parent614db395e5972866f404fe411e639e457e9bd556 (diff)
Change logic: Prepend @ to indicate host (bare word is now always command).
Diffstat (limited to 'xsh')
-rwxr-xr-xxsh8
1 files changed, 6 insertions, 2 deletions
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