summaryrefslogtreecommitdiff
path: root/xsh
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2016-10-22 15:50:36 +0200
committerJonas Smedegaard <dr@jones.dk>2016-10-22 15:50:36 +0200
commit1e2e5d80a02c2806c4a988920b4f1094f9108dec (patch)
tree8121d99a61d07c8399ceafa02ad967f88a4e25e7 /xsh
parent39bbb9a8ca83689942ad6857202309523b1f33b4 (diff)
Simplify wrap sudo.
Diffstat (limited to 'xsh')
-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