Date: Sun, 19 Sep 2010 16:13:47 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r212865 - stable/8/bin/test Message-ID: <201009191613.o8JGDlWZ007733@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun Sep 19 16:13:47 2010 New Revision: 212865 URL: http://svn.freebsd.org/changeset/base/212865 Log: MFC r212418: test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||. Modified: stable/8/bin/test/test.1 Directory Properties: stable/8/bin/test/ (props changed) Modified: stable/8/bin/test/test.1 ============================================================================== --- stable/8/bin/test/test.1 Sun Sep 19 16:06:32 2010 (r212864) +++ stable/8/bin/test/test.1 Sun Sep 19 16:13:47 2010 (r212865) @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd July 31, 2006 +.Dd September 10, 2010 .Dt TEST 1 .Os .Sh NAME @@ -310,6 +310,14 @@ are evaluated consistently according to standards document. All other cases are subject to the ambiguity in the command semantics. +.Pp +In particular, only expressions containing +.Fl a , +.Fl o , +.Cm \&( +or +.Cm \&) +can be ambiguous. .Sh EXIT STATUS The .Nm @@ -338,12 +346,11 @@ specification. Both sides are always evaluated in .Fl a and -.Fl o , -unlike in the logical operators of -.Xr sh 1 . +.Fl o . For instance, the writable status of .Pa file will be tested by the following command even though the former expression indicated false, which results in a gratuitous access to the file system: -.Pp .Dl "[ -z abc -a -w file ]" +To avoid this, write +.Dl "[ -z abc ] && [ -w file ]"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009191613.o8JGDlWZ007733>