summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xxsh7
1 files changed, 2 insertions, 5 deletions
diff --git a/xsh b/xsh
index 3fa48e9..31608c3 100755
--- a/xsh
+++ b/xsh
@@ -46,6 +46,8 @@ done
[ $# -gt 0 ] || set -- /bin/bash
+[ -z "$SUDO" ] || set -- sudo -i -- "$@"
+
# Split program name from its options
if [ $# -gt 0 ]; then
prg_base=$1
@@ -60,14 +62,11 @@ fi
prg="$prg_base $prg_opts"
prg_su="echo -n 'Changing to root...: '; su -c \"cd; $prg\""
-prg_sudo="sudo -i -- $prg"
case "$HOST" in
'')
if [ -n "$SU" ]; then
termwrapper $prg_su
- elif [ -n "$SUDO" ]; then
- termwrapper $prg_sudo
else
termwrapper $prg
fi
@@ -75,8 +74,6 @@ case "$HOST" in
*)
if [ -n "$SU" ]; then
termwrapper ssh $ssh_opts $HOST $prg_su
- elif [ -n "$SUDO" ]; then
- termwrapper ssh $ssh_opts $HOST $prg_sudo
else
termwrapper ssh $ssh_opts $HOST $prg
fi