showrun.lee <[EMAIL PROTECTED]> writes:

> [  !  "$test"  -a "$test1"  ] && test="papa";

This is a test with four arguments, thus the rules are:

  • If $1 is ’!’, negate the three-argument test of $2, $3, and $4.
  • If $1 is ’(’ and $4 is ’)’, perform the two-argument test of $2 and $3.
  • Otherwise, the results are unspecified.

Since "$test" -a "$test1" is false, the test comes out as true.

Using test with a combination of more than one primary operator is not
recommended.

> I think ,this is a bug in bash.and i test it on many freebsd release 4.11,
> 6.1,6.2 with default bash version,this is same.

Your /bin/sh is not POSIX compliant.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Reply via email to