]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Document changes of 2003-07-24.
authorJim Meyering <jim@meyering.net>
Sat, 26 Jul 2003 12:18:21 +0000 (12:18 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 26 Jul 2003 12:18:21 +0000 (12:18 +0000)
doc/coreutils.texi

index fc83a87c3fded0d533a9c68b5a853a30d9079b1d..05dcd668b235817432a43b2b803ff4aa57fb1d2c 100644 (file)
@@ -8692,15 +8692,36 @@ expression must be a separate argument.
 @command{test} has file status checks, string operators, and numeric
 comparison operators.
 
+@command{test} has an alternate form that uses opening and closing
+square brackets instead a leading @samp{test}.  For example, instead
+of @samp{test -d /}, you can write @samp{[ -d / ]}.  The square
+brackets must be separate arguments; for example, @samp{[-d /]} does
+not have the desired effect.  Since @samp{test @var{expr}} and @samp{[
+@var{expr} ]} have the same meaning, only the former form is discussed
+below.
+
 @cindex conflicts with shell built-ins
 @cindex built-in shell commands, conflicts with
 Because most shells have a built-in command by the same name, using the
 unadorned command name in a script or interactively may get you
 different functionality than that described here.
 
-Besides the options below, @command{test} accepts a lone @option{--help} or
-@option{--version}.  @xref{Common options}.  A single non-option argument
-is also allowed: @command{test} returns true if the argument is not null.
+Besides the options below, a single argument is also allowed:
+@command{test} returns true if the argument is not null.  The argument
+can be any string, including strings like @samp{-d}, @samp{-1},
+@samp{--}, @samp{--help}, and @samp{--version} that most other
+programs would treat as options.  To get help and version information,
+invoke the commands @samp{[ --help} and @samp{[ --version}, without
+the usual closing brackets.  @xref{Common options}.
+
+@cindex exit status of @command{test}
+Exit status:
+
+@display
+0 if the expression is true,
+1 if the expression is false,
+2 if an error occurred.
+@end display
 
 @menu
 * File type tests::             -[bcdfhLpSt]
@@ -8759,11 +8780,11 @@ True if @var{file} exists and is a named pipe.
 @cindex socket check
 True if @var{file} exists and is a socket.
 
-@item -t [@var{fd}]
+@item -t @var{fd}
 @opindex -t
 @cindex terminal check
-True if @var{fd} is opened on a terminal.  If @var{fd} is omitted, it
-defaults to 1 (standard output).
+True if @var{fd} is a file descriptor that is associated with a
+terminal.
 
 @end table