summaryrefslogtreecommitdiff
path: root/xsh
diff options
context:
space:
mode:
Diffstat (limited to 'xsh')
-rwxr-xr-xxsh22
1 files changed, 4 insertions, 18 deletions
diff --git a/xsh b/xsh
index 9830df1..c7a8364 100755
--- a/xsh
+++ b/xsh
@@ -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