![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS Companion for UNIX Environments |
The way in which you define an environment variable
depends on the shell that you are running. In the Bourne shell and in the
Korn shell, use the
export
command to export one or more variables to the environment. For example,
these commands make the value of the variable
scname available to all
subsequent shell scripts:
$ scname=phonelist $ export scnameIn the Korn shell, you can combine these into one command:
$ export scname=phonelist
If you change the value of
scname, the new value affects
both the shell variable and the environment variable. If you do not export
a variable, only the shell script in which you define has access to its value.
In the C shell, you set (define and export) environment
variables with the
setenv
(set environment) command. For example, this command is equivalent to the
commands shown previously:
% setenv scname phonelist
Use the
echo command and parameter substitution to display the values of individual
environment variables, just as you do for shell variables, for example:
echo $SHELLUse the
env (or
printenv) command to display all environment variables and their current
values.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.