rxvt.menu 2.3 KB

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