From owner-svn-src-stable-7@FreeBSD.ORG Thu Sep 23 19:36:34 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F46106567A; Thu, 23 Sep 2010 19:36:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7AD18FC1A; Thu, 23 Sep 2010 19:36:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8NJaYi4078541; Thu, 23 Sep 2010 19:36:34 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8NJaYI2078539; Thu, 23 Sep 2010 19:36:34 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009231936.o8NJaYI2078539@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 23 Sep 2010 19:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213083 - stable/7/bin/test X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Sep 2010 19:36:35 -0000 Author: jilles Date: Thu Sep 23 19:36:34 2010 New Revision: 213083 URL: http://svn.freebsd.org/changeset/base/213083 Log: MFC r212418: test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||. Modified: stable/7/bin/test/test.1 Directory Properties: stable/7/bin/test/ (props changed) Modified: stable/7/bin/test/test.1 ============================================================================== --- stable/7/bin/test/test.1 Thu Sep 23 19:21:49 2010 (r213082) +++ stable/7/bin/test/test.1 Thu Sep 23 19:36:34 2010 (r213083) @@ -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 ]"