diff options
author | jilles <jilles@FreeBSD.org> | 2010-09-10 14:00:27 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-09-10 14:00:27 +0000 |
commit | d26fd835e7dee88b385c24b887dce1f25737a7b6 (patch) | |
tree | 59422c51f781292652ff60fed069c0f76ab3ad6f /bin/test | |
parent | 3f97220f48c8bbe484b5f2df6a364d24f1b7df21 (diff) | |
download | FreeBSD-src-d26fd835e7dee88b385c24b887dce1f25737a7b6.zip FreeBSD-src-d26fd835e7dee88b385c24b887dce1f25737a7b6.tar.gz |
test(1): Clarify grammar ambiguity and -a/-o vs shell &&/||.
Diffstat (limited to 'bin/test')
-rw-r--r-- | bin/test/test.1 | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/bin/test/test.1 b/bin/test/test.1 index 726542d..cbeff94 100644 --- a/bin/test/test.1 +++ b/bin/test/test.1 @@ -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 the rules specified in the 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 ]" |