View Single Post

   
  #3 (permalink)  
Old 01-16-2008, 08:39 PM
Frank Slootweg
 
Posts: n/a
Default Re: check for existence of environment variable

pc <chalk@netspace.net.au> wrote:
> hi all,
>
> I am having a problem checking for the existence of an environment
> variable on an new HP-UX box (11.11) under ksh: This script for
> example:
>
> if [ -n "$MYVAR" ] ; then
> echo "MYVAR is set"
> else
> echo "MYVAR is not set"
> fi
>
> runs under ksh on an older (B.11.00) box but will not run under ksh on
> this new box (B.11.11).
>
> error is: ksh: @: parameter not set

^

Why does it says "@"? I.e. what is "@" in your script or in some
input?

BTW, the code snippet looks OK. It's essential to have quotes around
$MYVAR in the test ("[ ... ]") statement, in case MYVAR is not set, but,
if this is the actual code, you have that covered.

> If anyone has any thoughts on this matter it would be much appreciated.
>
> TIA
>
> eddiec :-)

Reply With Quote