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

2006-07-31 Thread Bob Proulx
Poor Yorick 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

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

2006-07-31 Thread Dave Rutherford
On 7/31/06, Paul Jarc <[EMAIL PROTECTED]> wrote: "Dave Rutherford" <[EMAIL PROTECTED]> wrote: > On 7/31/06, Poor Yorick <[EMAIL PROTECTED]> wrote: >> : ${FAKEVAR?} || echo hello > > Try this and then run your script: > > export FAKEVAR="echo This could have been rm -rf $HOME" That won't do anyth

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

2006-07-31 Thread Paul Jarc
mwoehlke <[EMAIL PROTECTED]> wrote: > Poor Yorick wrote: >> The following line does not perform the "echo" command. >> : ${FAKEVAR?} || echo hello > > What you probably want is: > [ "$FAKEVAR" ] || echo hello That doesn't distinguish between an unset variable and a variable set to an empty value.

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

2006-07-31 Thread Paul Jarc
"Dave Rutherford" <[EMAIL PROTECTED]> wrote: > On 7/31/06, Poor Yorick <[EMAIL PROTECTED]> wrote: >> : ${FAKEVAR?} || echo hello > > Try this and then run your script: > > export FAKEVAR="echo This could have been rm -rf $HOME" That won't do anything. The contents of $FAKEVAR, if any, are just pa

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

2006-07-31 Thread mwoehlke
Poor Yorick 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

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

2006-07-31 Thread Dave Rutherford
On 7/31/06, Poor Yorick <[EMAIL PROTECTED]> 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

null command and parameter expansion for "Display error if null or unset"

2006-07-31 Thread Poor Yorick
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 var

(no subject)

2006-07-31 Thread Poor Yorick
The following command does not echo "hello". : ${FAKEVAR?} || echo hello This seems inconsistent, since the return status is set to 1. It would be a convenient and concise syntax for acting on unset variables. -- Poor Yorick ___ Bug-bash mailing l