summaryrefslogtreecommitdiff
path: root/xsh
diff options
context:
space:
mode:
Diffstat (limited to 'xsh')
-rwxr-xr-xxsh20
1 files changed, 14 insertions, 6 deletions
diff --git a/xsh b/xsh
index 9c31b06..65429ef 100755
--- a/xsh
+++ b/xsh
@@ -64,18 +64,26 @@ while [ $# -gt 0 ]; do
done
set -- $args
+# get hostname unless already given or not there
if [ -z "$HOST" ]; then
- HOST=$1
- shift
+ if [ $# -gt 1 ]; then
+ HOST=$1
+ shift
+ else
+ HOST="localhost"
+ fi
fi
if [ -z "$HOST" ]; then
usage
exit 1
fi
-prg_base=$1
-shift
-prg_opts=$@
+# Split program name from its options
+if [ $# -gt 0 ]; then
+ prg_base=$1
+ shift
+ prg_opts=$@
+fi
if [ "$X" = 1 -a "$SU" = 1 -a "$SUHACK" != 1 ]; then
args="root@$args"
@@ -93,7 +101,7 @@ if [ "$V" = 1 ]; then
fi
## Don't open 2 shells if no program is run - Disabled for now (something wrong with the test...)
-#if [ -z "$prg_base" -a -z "$prg_opts" -a $SUU != 1 ]; then
+#if [ -z "$prg_base" -a -z "$prg_opts" -a "$SUU" != 1 ]; then
# title="$SCRIPT"
# prg_local=''
# prg_remote=''