: I am using C shell and have a question.
: Q. What's the difference between shell variables and environment variables?
: I needed to use $OSMART in several C-shell scripts. I tried
: set OSMART=/n/abyss/3
: in my .cshrc. It didn't work!! Then I use
: setenv OSMART /n/abyss/3
: in my .cshrc. It worked this time. I have no idea what the differnce is and
: when to use which?
Shell variables are local to the current shell. Environment variables
are global meaning that they are available to any new program executed
after they are set. This program could be another shell.
In csh, the process of setting shell variables is distinct from
environment variables. In sh and ksh you "bind" the shell variables
to the environment variables (using the export statement) so that
when you change a shell variable, the environment variable changes.
Note that this is a rather abbreviated answer. There is a lot more to put
together the big picture.
Phil Hughes, SSC, Inc. P.O. Box 55549, Seattle, WA 98155 (206)FOR-UNIX
Quote:>>> Publishers of pocket references for UNIX, C, VI, Emacs, Ksh, MS-DOS, ... <<<