[Top][All Lists]

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

Re: test -n STRING and test STRING differ

From: Paul Eggert
Subject: Re: test -n STRING and test STRING differ
Date: Sun, 05 Sep 2004 00:35:19 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Dan Jacobson <address@hidden> writes:

> The docs make it look like test -n STRING and test STRING do the
> same. However,
> $ /usr/bin/test ``; echo $?
> 1
> $ /usr/bin/test -n ``; echo $?
> 0
> $ test ``; echo $?
> 1
> $ test -n ``; echo $?
> 0

Those test cases are misleading, since they use ` (accent grave)
instead of ' (apostrophe).  The accent grave characters vanish before
"test" is invoked, so the tests are actually comparing "test" (with no
arguments) to "test -n".  The behavior you're observing conforms to
POSIX, so I don't see any bug.

reply via email to

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