[Top][All Lists]

[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 (X11/20070911)

On 09/20/2007 07:46 PM, Paul Jarc wrote:
address@hidden wrote:
        [ -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,


reply via email to

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