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

Re: bash bug? test -r works

On Fri, Mar 29, 2002 at 10:38:40AM -0500, Steve M. Robbins wrote:
> In contrast, /bin/sh on SGI's IRIX 6.5 returns a diagnostic
>     $ test -x
>     /bin/sh: test: argument expected
>     $ echo $?
>     1
> It looks like a bug in bash & ash to me.  Is it?

Nope. Bug in IRIX. If test gets only one argument it is supposed to
return true if that argument is nonzero and false otherwise. Note that
this is alluded to in the test(1) manpage:
       [-n] STRING
              the length of STRING is nonzero
(which indicates that the -n argument is optional) Relying on this
behavior is inadvisable, since *many* systems will (incorrectly) attempt
to parse singleton arguments; -n should always be used when testing
nonzero strings for portability.

Mike Stone

Attachment: pgpR36Hq9ce1X.pgp
Description: PGP signature

Reply to: