[Top][All Lists]

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

test -n STRING != test STRING if there is no STRING [duh]

From: Dan Jacobson
Subject: test -n STRING != test STRING if there is no STRING [duh]
Date: Mon, 16 Sep 2002 09:30:21 +0800

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-pc-linux-gnu' 
-I/home/doko/packages/bash/bash-2.05a/lib -g -O2
uname output: Linux debian 2.4.18-k7 #1 Sun Apr 14 13:19:11 EST 2002 i686 
Machine Type: i386-pc-linux-gnu

Bash Version: 2.05a
Patch Level: 0
Release Status: release

Description: [It's the old "fool 'em with the esotericism", making 'em
send off bug reports] Gentlemen, no matter if /usr/bin/test or bash
builtin test, we often think these are equivalent:

     True if the length of STRING is nonzero.

Yes, if one supplies STRING, i.e. "" then the two are the same.
Yes, one legally must supply STRING, if not, then as usual, behaviour
is undefined, I suppose. However, users might still think behaviour is
the same, thinking "why this":
set -e 
a= #or a="", same deal
test -n $a
echo how did I get here,
test $a
echo but not here?

Therefore, both the gnu test, and bash test:
documentation should be changed to emphasize what happens in just the
$ test
case, which seems hardly dealt with in any "test" docs, and also words like
|    These options test string characteristics.  Strings are not quoted
| for `test', though you may need to quote them to protect characters
| with special meaning to the shell, e.g., spaces.
in the gnu test Info manual perhaps should be beefed up to prevent the
above misunderstanding.
http://jidanni.org/ Taiwan(04)25854780

reply via email to

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