source:
trunk/essentials/app-shells/bash/examples/functions/term@
3247
| Last change on this file since 3247 was 3228, checked in by , 19 years ago | |
|---|---|
| File size: 480 bytes | |
| Line | |
|---|---|
| 1 | # |
| 2 | # term -- a shell function to set the terminal type interactively or not. |
| 3 | # |
| 4 | |
| 5 | term() |
| 6 | { |
| 7 | local t |
| 8 | |
| 9 | if [ $# != 0 ] ; then |
| 10 | eval $(tset -sQ $1) |
| 11 | else # interactive |
| 12 | if [ -z "$TERM" ] ; then |
| 13 | TERM="unknown" |
| 14 | fi |
| 15 | |
| 16 | case "$TERM" in |
| 17 | network|dialup|unknown|lat) |
| 18 | TERM=unknown |
| 19 | ;; |
| 20 | *) |
| 21 | eval $(tset -sQ) |
| 22 | ;; |
| 23 | esac |
| 24 | |
| 25 | while [ "$TERM" = "unknown" ] ; do |
| 26 | echo -n "Terminal type: " |
| 27 | read t |
| 28 | if [ -n "$t" ] ; then |
| 29 | eval $(tset -sQ $t) |
| 30 | fi |
| 31 | done |
| 32 | fi |
| 33 | } |
| 34 | |
