bug-bash
[Top][All Lists]
Advanced

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

Re: "[ -n ${emptyvariable} ]" returns success


From: Jonathan Kamens
Subject: Re: "[ -n ${emptyvariable} ]" returns success
Date: Thu, 20 Sep 2007 20:13:53 -0400
User-agent: Thunderbird 2.0.0.6 (X11/20070911)

On 09/20/2007 07:46 PM, Paul Jarc wrote:
jik@kamens.brookline.ma.us wrote:
        foo=
        [ -n ${foo} ] && echo true

        Prints "true".
That's the correct behavior.
OK, thanks for the explanation. It makes sense, although I think it's just a little gross. ;-)

To avoid pitfalls like this, always quote variable expansions.  The [[
command is also less tricky.
Yes, I know that, but the person who wrote the code in which I noticed this issue apparently does not :-).

Thanks again,

 jik


reply via email to

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