Date: Mon, 2 Sep 1996 08:31:48 +0200 (MET DST) From: J Wunsch <j@uriah.heep.sax.de> To: freebsd-current@FreeBSD.org (FreeBSD-current users) Cc: bde@zeta.org.au (Bruce Evans), jkh@time.cdrom.com (Jordan K. Hubbard) Subject: Re: Anyone mind if I remove the following braindamage from test(1)? Message-ID: <199609020631.IAA22016@uriah.heep.sax.de> In-Reply-To: <13843.841630272@time.cdrom.com> from "Jordan K. Hubbard" at "Sep 1, 96 07:11:12 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
As Jordan K. Hubbard wrote: > root@time-> [ -d /tmp ] && echo Yup, its a directory > Yup, its a directory > root@time-> [ -d ] && echo Yup, its a directory > Yup, its a directory No: j@uriah 651% [ -d ] && echo Yup, -d aint empty. Yup, -d aint empty. That's apparently the reasoning behind. > Is there any POSIX weirdness which > mandates that test not do proper argument checking? The algorithm for determining the precedence of the operators and the 1 return value that shall be generated is based on the number of arguments 1 presented to test. (However, when using the [...] form, the right- 1 bracket final argument shall not be counted in this algorithm.) In the 1 following list, $1, $2, $3, and $4 represent the arguments presented to 1 test. 1 0 arguments: 1 Exit false (1). 1 1 argument: 1 Exit true (0) if $1 is not null; otherwise, exit false. 1 ... So unless this has been changed again in the standard (the above is from a draft), leave it as it is. -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609020631.IAA22016>