diff options
Diffstat (limited to 'xsh')
-rwxr-xr-x | xsh | 83 |
1 files changed, 38 insertions, 45 deletions
@@ -8,25 +8,27 @@ function usage () { function termwrapper () { PRG=$@ - title="$title $titleopt" + titletext="$title $titleopt" [ "$V" = 1 ] && echo $PRG -# case `readlink /etc/alternatives/x-terminal-emulator | xargs basename` in -# rxvt*) -# opts="+sb -sl 500 -n \"$title\" -title \"$title\"" -# ;; -# esac + case `readlink /etc/alternatives/x-terminal-emulator | xargs basename` in +# rxvt*) opts="+sb -sl 500 -n \"$titletext\""; titleoptname="-title";; + rxvt*) opts="+sb -sl 500"; titleoptname="-title";; + *xterm) opts="+sb -sl 500 +wc"; titleoptname="-title";; + gnome-terminal) opts=""; titleoptname="--title";; + gnome-terminal.wrapper) opts=""; titleoptname="-title";; + konsole*) opts="--notoolbar"; titleoptname="-T";; + *) opts=""; titleoptname="-T";; + esac if [ -n "$PRG" ]; then -# rxvt +sb -sl 500 -n "$title" -title "$title" -e $PRG & -# exec rxvt +sb -sl 500 -n "$title" -title "$title" -e $PRG - x-terminal-emulator +sb -sl 500 -n "$title" -title "$title" -e $PRG & -# x-terminal-emulator $opts -e $PRG & +# x-terminal-emulator +sb -sl 500 -n "$title" -title "$title" --title "$title" -e $PRG & + x-terminal-emulator $opts $titleoptname "$titletext" -e $PRG & +# exec x-terminal-emulator $opts $titleoptname "$title" -e $PRG & else -# rxvt +sb -sl 500 -n "$title" -title "$title" & -# exec rxvt +sb -sl 500 -n "$title" -title "$title" - x-terminal-emulator +sb -sl 500 -n "$title" -title "$title" & -# x-terminal-emulator $opts & +# exec x-terminal-emulator +sb -sl 500 -n "$title" -title "$title" --title "$title" & + x-terminal-emulator $opts $titleoptname "$titletext" & +# exec x-terminal-emulator $opts $titleoptname "$title" & fi } @@ -61,19 +63,15 @@ while [ $# -gt 0 ]; do done set -- $args -# get hostname unless already given or not there +# Make sure we have a hostname if [ -z "$HOST" ]; then - if [ $# -gt 1 ]; then + if [ $# -gt 0 ]; then HOST=$1 shift else HOST="localhost" fi fi -if [ -z "$HOST" ]; then - usage - exit 1 -fi # Split program name from its options if [ $# -gt 0 ]; then @@ -97,40 +95,35 @@ if [ "$V" = 1 ]; then prg_opts="$prg_opts; sleep 4" 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 -# title="$SCRIPT" -# prg_local='' -# prg_remote='' -#else - if [ -z "$prg_base" ]; then - title="$SCRIPT" - prg_base='/bin/bash' - else - title="$prg_base" - prg_opts_local="$prg_opts" - prg_opts_remote="$prg_opts" - fi - - # Special cases for specific programs - case $prg_base in - # 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" - 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 [ -z "$prg_base" ]; then + title="$SCRIPT" + prg_base='/bin/bash' +else + title="$prg_base" + prg_opts_local="$prg_opts" + prg_opts_remote="$prg_opts" +fi + +# Special cases for specific programs +case $prg_base in + # Force Midnight Commander colors and support slow connections + mc) prg_opts_local="-c $prg_opts_local"; prg_opts_remote="-s -c $prg_opts_remote";; +esac + +prg_local="$prg_base $prg_opts_local" +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\"" if [ "$SU" != 1 ]; then if [ $HOST = "localhost" ]; then termwrapper $prg_local else + titleopt="[$HOST]" termwrapper ssh $ssh_opts $HOST $prg_remote fi else if [ "$SUHACK" = 1 ]; then + titleopt="[$HOST]" # termwrapper ssh $ssh_opts $HOST su $su_opts -c \"$prg_remote\" termwrapper ssh $ssh_opts $HOST $prg_remote else |