bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: null command and parameter expansion for "Display error if null or u


From: Dave Rutherford
Subject: Re: null command and parameter expansion for "Display error if null or unset"
Date: Mon, 31 Jul 2006 12:59:28 -0400

On 7/31/06, Poor Yorick <address@hidden> wrote:
The following line does not perform the "echo" command.

: ${FAKEVAR?} || echo hello

This seems inconsistent, since the return status is set to one, not to mention 
that the null command is documented to return a zero exit code.  It would be a 
convenient and concise syntax for acting on unset variables.

Try this and then run your script:

export FAKEVAR="echo This could have been rm -rf $HOME"

to see why not to do it this way.

On the other hand, if you already know FAKEVAR is not set,
why are you performing a test?

Dave




reply via email to

[Prev in Thread] Current Thread [Next in Thread]