Date: Mon, 02 Sep 1996 16:08:24 -0700 From: "David E. Tweten" <tweten@frihet.com> To: Terry Lambert <terry@lambert.org> 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)? Message-ID: <199609022308.QAA10870@ns.frihet.com>
next in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609022308.QAA10870>