Matthew Woehlke <[EMAIL PROTECTED]> wrote:
> Stephane Chazelas wrote:
>> [ -n "$foo" -a -n "$bar" ]
>> is not the expression to test whether both "$foo" and "$bar" are
>> non-empty, as it would fail for some specific values of $foo or
>> $bar (try it when $foo contains "=" for instance).
>
> Huh? Why would having an '=' in foo have any effect?

I think Stephane meant the exact string "=", not any string containing
"=".  

> "$foo" is still a string, it should not be subject to word splitting

Right, but it is special to the test/[ command.

$ [ -n = -a -n z ]
bash: [: too many arguments

Here, "=" is interpreted as a binary operator, not as the operand of
"-n".


paul


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to