## 3.14. Terminal Setup: Testing Environment Variables

Certain systems set certain environment variables. For example, the X Window System sets a DISPLAY environment variable (Section 35.5). If you've logged in from a remote system using ssh (Section 1.21), look for variables like SSH_CLIENT and SSH_TTY or SSH_AUTH_SOCK on the system you log in to. (If you aren't sure about your system, use the env or printenv command (Section 35.3) to look for changes in your environment at different systems.)

Your shell setup file (Section 3.3) makes decisions based on the environment variables that have been set. Here are examples for both C-type and Bourne-type shells:

`[ ]` Section 35.26

>     if ($?DISPLAY) then                 if [ -n "$DISPLAY" ]; then
>        # on X window system                # on X window system
>        ...                                 ...
>     else if ($?XDARWIN_VERSION) then    elif [ -n "$XDARWIN_VERSION" ]; then
>        # on MacOS X system                 # on MacOS X system
>        ...                                 ...
>     else                                else
>        ...                                 ...
>     endif                               fi

--JP and SJC

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