From owner-svn-src-stable-8@FreeBSD.ORG Sun Sep 19 16:13:48 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D026106566C; Sun, 19 Sep 2010 16:13:48 +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 0C3468FC15; Sun, 19 Sep 2010 16:13:48 +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 o8JGDlh9007735; Sun, 19 Sep 2010 16:13:47 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8JGDlWZ007733; Sun, 19 Sep 2010 16:13:47 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201009191613.o8JGDlWZ007733@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 19 Sep 2010 16:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212865 - stable/8/bin/test X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Sep 2010 16:13:48 -0000 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 ]"