diff options
Diffstat (limited to 'xsh')
-rwxr-xr-x | xsh | 22 |
1 files changed, 4 insertions, 18 deletions
@@ -3,7 +3,7 @@ SCRIPT=$(basename $0) usage() { - echo "Usage: $SCRIPT [--x] [--verbose] [[su] [{user}@]{host}] [--] [remote command...]" + echo "Usage: $SCRIPT [--x] [--verbose] [[su] [{user}@]{host}] [-- command...]" } termwrapper() { @@ -31,7 +31,6 @@ V='' HOST='' ssh_opts="-t" -args='' while [ $# -gt 0 ]; do case $1 in su) SU=1;; @@ -39,25 +38,12 @@ while [ $# -gt 0 ]; do --ssh2|-2) ssh_opts="$ssh_opts -2";; --verbose|-v) V=1; ssh_opts="$ssh_opts -v";; --port|-p) ssh_opts="$ssh_opts -p $2"; shift;; - --host|-h) HOST=$1;; - -) HOST="localhost";; - --) shift; args="$args$@ "; break;; + --) shift; break;; -*) usage; exit 1;; - *) args="$args$1 ";; + *) [ -z "$HOST" ] && HOST=$1 || break;; esac shift done -set -- $args - -# Make sure we have a hostname -if [ -z "$HOST" ]; then - if [ $# -gt 0 ]; then - HOST=$1 - shift - else - HOST="localhost" - fi -fi # Split program name from its options if [ $# -gt 0 ]; then @@ -90,7 +76,7 @@ prg="$prg_base $prg_opts" prg_su="echo -n 'Changing to root...: '; su -c \"cd; $prg\"" case "$HOST" in - *@localhost|localhost) + '') if [ -n "$SU" ]; then termwrapper $prg_su else |