1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
#!/bin/sh --
# an example of having different menus (even different pixmaps)
# show up depending on the machine you are rlogin/telnet connecting to
menu="$0" # or any convenient database
exe="../../src/wterm" # default program to execute
# exe="/usr/local/bin/wterm-2.21" # default program to execute
if test $# -gt 0; then
# if first argument contains "wterm" use that instead
case $1 in *wterm*) exe="$1" shift;; esac
fi
while [ $# -gt 0 ]
do
case $1 in
-h) # give usage
echo "
Usage: `basename $0` [wterm-prgm] [options]
start wterm
and load a menu corresponding to \"machine\" if the option
-e {rlogin|telnet|tn3270} Machine.Domain ...
was used"
exit
;; # don't bother if we've already set it
-menu) break;; # don't bother if we've already set it
-e)
if test $# -ge 3;
then
case $2 in
# try to find menu for these cases
*rlogin | *telnet | *tn3270)
# strip domain & convert case
mach=`echo $3 | sed -e 's/\..*$//' | tr [A-Z] [a-z]`
if test ! -z "$mach";
then
found=`egrep "^\[menu:$mach\]" $menu`
if test ! -z "$found";
then
mach="$menu;$mach"
exe="$exe -menu $mach"
fi
fi
;;
esac
fi
break
;;
*)
exe="$exe $1"
;;
esac
shift
done
# echo "$exe $@"
$exe $@ &
exit # stop shell here!
#-------------------------------------------------------------------------
[menu:weber]
#[menu:machine1]
[clear]
# [pixmap:machine1.xpm]
/Programs/*
{Edit} ${EDITOR:-vi}\r
{Mail} Mail\r
{News} News\r
{-}
{Exit} exit\r
/Jobs/*
{Top} top\r
{Ps u} ps aux|egrep ^$USER
{Ps aux} ps aux|egrep -v "(root|ps)"
# who's REALLY logged on (even with utmp logging turned off)
{Who} ps aux|egrep "\-bash"|egrep -v "grep"
{-}
{Background} ^Z bg\r
{Kill} ^C\r
/Misc/*
{Dir} ls -la|${PAGER:-more}\r
{Dir-Time} ls -lat|${PAGER:-more}\r
{Space Left} df\r
[read:terminal]
[show]
#[done:machine1]
[done:weber]
#-------------------------------------------------------------------------
[menu:conn]
#[menu:machine2]
[clear]
# [pixmap:machine2.xpm]
/Programs/*
{Edit} ${EDITOR:-vi}\r
{Checkmail} checkmail\r
{Dir} ls -la|${PAGER:-more}\r
{Dir-Time} ls -lat|${PAGER:-more}\r
{Space Left} df\r
{-}
{Exit} exit\r
/Jobs/*
{Background} ^Z bg\r
{Kill} ^C\r
[read:terminal]
[show]
#[done:machine2]
[done:conn]
#--------------------------------------------------------------------- eof
|