Unix Power ToolsUnix Power ToolsSearch this book

3.11. Terminal Setup: Testing TERM

If you use several different kinds of terminals (or, as is far more common these days, terminal emulators) and your TERM environment variable is set differently on each terminal, you can add a test like this to your C shell .login file:

switch ($TERM)
case vt100:
   ...do commands for vt100
   breaksw
case xxx:
   ...do commands for xxx
   breaksw
default:
   ...do commands for other terminals
   breaksw
endsw

If you have a Bourne-type shell, use a case statement (Section 35.10) in your .profile instead:

case "$TERM" in
    vt100)
        ...do commands for vt100
        ;;
    xterm)
        ...do commands for xterm
        ;;
    *)
        ...do commands for other terminals
        ;;
esac

--JP and SJC



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.