[plug] Shell Scripting Confusion

Christian christian at global.net.au
Wed Feb 9 13:26:15 WST 2000


Mike Holland wrote:
> 
> On Wed, 9 Feb 2000, Christian wrote:

> When you see the answer you'll want to stick with perl.
> Shell programming is ugly.

Well, I do really want to stick with Perl but I'm hacking one of the
scripts on the system so while it's very tempting to just do "perl -e
'<insert nice, sensible, sane code in here>'", it doesn't look that good
really, does it? :-)

> > if [ -n $output ]; then
> 
> Since $output is empty, that evaluates as  "if [ -n ]; then "
> which ought to at least give an error message?
> 
> Try:
>         if [ -n "$output" ]; then
> 
> I'll bet you're groaning by now.

Hmmm... yeah, a little... but why does $output evaluate to being empty
whereas "$output" has meaning?  Is it that you require the quotes to
actually turn it into a string?

Thanks for your help,

Christian.



More information about the plug mailing list