bug-bash
[Top][All Lists]
Advanced

[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 18:05:03 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Dan Jacobson <jidanni@jidanni.org> writes:

> Please add a warning.

There's already a warning in the coreutils documentation, but I made
it a bit more explicit as follows:

2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>

        * doc/coreutils.texi (String tests): Improve quality of warning about
        quoting strings for the shell.

Index: coreutils.texi
===================================================================
RCS file: /home/eggert/coreutils/cu/doc/coreutils.texi,v
retrieving revision 1.203
retrieving revision 1.204
diff -p -u -r1.203 -r1.204
--- coreutils.texi      3 Sep 2004 08:00:48 -0000       1.203
+++ coreutils.texi      6 Sep 2004 01:03:20 -0000       1.204
@@ -9553,9 +9553,15 @@ numbers, i.e., if they are hard links to
 
 @cindex string tests
 
-These options test string characteristics.  Strings are not quoted for
-@command{test}, though you may need to quote them to protect characters
-with special meaning to the shell, e.g., spaces.
+These options test string characteristics.  You may need to quote
+@var{string} arguments for the shell.  For example:
+
+@example
+test -n "$V"
+@end example
+
+The quotes here prevent the wrong arguments from being passed to
+@command{test} if @samp{$V} is empty or contains special characters.
 
 @table @samp
 





reply via email to

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