From owner-freebsd-current Mon Sep 2 16:10:22 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA18264 for current-outgoing; Mon, 2 Sep 1996 16:10:22 -0700 (PDT) Received: from ns.frihet.com (root@frihet.bayarea.net [205.219.92.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id QAA18258 for ; Mon, 2 Sep 1996 16:10:19 -0700 (PDT) Received: from ns.frihet.com (tweten@localhost [127.0.0.1]) by ns.frihet.com (8.7.5/8.6.12) with ESMTP id QAA10870; Mon, 2 Sep 1996 16:08:24 -0700 (PDT) Message-Id: <199609022308.QAA10870@ns.frihet.com> X-Mailer: exmh version 1.6.7 5/3/96 Reply-To: "David E. Tweten" To: Terry Lambert cc: jkh@time.cdrom.com (Jordan K. Hubbard), joerg_wunsch@uriah.heep.sax.de, freebsd-current@FreeBSD.org, bde@zeta.org.au Subject: Re: Anyone mind if I remove the following braindamage from test(1)? Date: Mon, 02 Sep 1996 16:08:24 -0700 From: "David E. Tweten" Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk Initially quoting someone else, terry@lambert.org said: >> I'd expect that to hold true only if the argument was not a flag >>argument which required a parameter, then I'd expect it to puke. >I agree; a flag isn't an argument, it's a flag. Ah, but POSIX test doesn't have flags. It has "operators" ("=", "!=", "-gt", and the like) and "elements of primaries". A primary is something like "-d file" (my quotes), which in this case contains two "elements". POSIX goes on to say that "string" (my quotes) is a primary that is true if the string is non-null. And, "All operators and elements of primaries shall be presented as separate arguments to the test utility." As has previously been quoted in this thread, it continues by saying that test with a single "argument" returns true (0) if that argument is non-null, and returns false (1) otherwise, obviously treating it as the "string" primary. So I guess under POSIX test, everything is an argument and [ -d ] is in fact a test to see of "-d" is the null string. -- David E. Tweten | 2047-bit PGP Key fingerprint: | tweten@frihet.com 12141 Atrium Drive | E9 59 E7 5C 6B 88 B8 90 | tweten@and.com Saratoga, CA 95070-3162 | 65 30 2A A4 A0 BC 49 AE | (408) 446-4131 Those who make good products sell products; those who don't, sell solutions.