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