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

Re: bash bug? test -r works



Steve M. Robbins <steven.robbins@videotron.ca> wrote:
> In debugging a shell script, I discovered that bash (and ash)
> treat

>        test -x 

> as true.  Normally, one would use "test -x SOMEFILE", and
> I would have expected a bare "test -x" to be a syntax error.
> However, both bash and ash return status 0 (true) with no
> diagnostics.

That's correct.  To get the result you want, use quotes, i.e.,

test -x "$SOMEFILE"
-- 
Debian GNU/Linux 2.2 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: