Results 1 to 2 of 2
Hello all,
I am new to scripting and I am using C Shell Script.
I can't find a way to check if an environment variable is defined/set already.
I found ...
- 06-29-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 4
Question:How to check if ENV_VAR is defined
Hello all,
I am new to scripting and I am using C Shell Script.
I can't find a way to check if an environment variable is defined/set already.
I found some test procedures like
if ( -z somefile )
# something to do here
else
# something to do here
endif
but all that i found check only file existence.
Do you know any test procedure that i can put in an if statement to check whether an environment variable is defined.
For example:
if( -defined $MY_ENV_VAR )
echo "env var defined"
else
echo "env var undefined"
endif
Thanks all.
- 06-29-2007 #2
Just check if the variable contains something/anything
if [ $VAR ] ; thenCan't tell an OS by it's GUI


Reply With Quote