summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2002-03-10 05:46:26 +0000
committerJonas Smedegaard <dr@jones.dk>2002-03-10 05:46:26 +0000
commit3224bc3a3dd870fd5fca7906df664de8b3d04907 (patch)
tree725518827403ea8e0eccc7986f6c4ab07ec9585d
parent7946251a86c7dafa299ca57e5c1fecec386cad53 (diff)
xsh: Various visual cleanup - and improve root window on localhost (no need to export TERM).
-rwxr-xr-xxsh35
1 files changed, 15 insertions, 20 deletions
diff --git a/xsh b/xsh
index 65429ef..b79209f 100755
--- a/xsh
+++ b/xsh
@@ -11,11 +11,6 @@ function termwrapper () {
title="$title $titleopt"
[ "$V" = 1 ] && echo $PRG
- # mc seem to have a bug separating upper- and lowercase with danish locale
-# case $LANG in
-# da_*) LANG=da;;
-# esac
-
# case `readlink /etc/alternatives/x-terminal-emulator | xargs basename` in
# rxvt*)
# opts="+sb -sl 500 -n \"$title\" -title \"$title\""
@@ -48,8 +43,10 @@ args=''
while [ $# -gt 0 ]; do
case $1 in
-su|su) SU=1;;
- -suu|suu) SU=1; SUU=1;; # Become root indirectly through a regular user (same as local user if -u not used)
- --user|-u) USER=$2; shift;; # Remote user allowed to switch to root
+ # Become root indirectly through a regular user (same as local user if -u not used)
+ -suu|suu) SU=1; SUU=1;;
+ # Remote user allowed to switch to root
+ --user|-u) USER=$2; shift;;
--x|-x|x) X=1; ssh_opts="$ssh_opts -X";;
--ssh2|-2) ssh_opts="$ssh_opts -2";;
--verbose|-v) V=1; ssh_opts="$ssh_opts -v";;
@@ -117,19 +114,13 @@ fi
# Special cases for specific programs
case $prg_base in
- mc) prg_opts_remote="-s -c $prg_opts_remote" # Midnight Commander has an option for slow connections
- ;;
+ # Midnight Commander has an option for slow connections
+ mc) prg_opts_remote="-s -c $prg_opts_remote";;
esac
prg_local="$prg_base $prg_opts_local"
- if [ "$SUU" = 1 ]; then
- prg_remote="echo -n 'Changing to root...: '; su $su_opts -c \"cd; $prg_base $prg_opts_remote\""
- else
-# prg_remote="bash -i -c \"$prg_base $prg_opts_remote\""
-# prg_remote="bash -i -c \"test -e /etc/debian_version || export TERM=xterm; $prg_base $prg_opts_remote\""
- prg_remote="bash --login -i -c \"test -e /etc/debian_version || export TERM=xterm; $prg_base $prg_opts_remote\""
-# prg_remote="bash -i -c \"test -e /etc/debian_version || export TERM=xterm; $prg_base $prg_opts_remote\""
- fi
+ prg_remote="bash --login -i -c \"test -e /etc/debian_version || export TERM=xterm; $prg_base $prg_opts_remote\""
+ prg_remote_suu="echo -n 'Changing to root...: '; su $su_opts -c \"cd; $prg_base $prg_opts_remote\""
#fi
if [ "$SU" != 1 ]; then
@@ -146,12 +137,16 @@ else
titleopt="[$HOST root]"
if [ "$SUU" = 1 ]; then
if [ -z "$USER" ]; then
- termwrapper ssh $ssh_opts $HOST $prg_remote
+ termwrapper ssh $ssh_opts $HOST $prg_remote_suu
else
- termwrapper ssh $ssh_opts $USER@$HOST $prg_remote
+ termwrapper ssh $ssh_opts $USER@$HOST $prg_remote_suu
fi
else
- termwrapper ssh $ssh_opts root@$HOST $prg_remote
+ if [ $HOST = "localhost" ]; then
+ termwrapper ssh $ssh_opts root@$HOST bash --login -i -c \"$prg_local\"
+ else
+ termwrapper ssh $ssh_opts root@$HOST $prg_remote
+ fi
fi
fi
fi