From owner-freebsd-current Sun Sep 1 23:52:41 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id XAA17040 for current-outgoing; Sun, 1 Sep 1996 23:52:41 -0700 (PDT) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id XAA17035 for ; Sun, 1 Sep 1996 23:52:35 -0700 (PDT) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id IAA29221; Mon, 2 Sep 1996 08:51:07 +0200 Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id IAA04468; Mon, 2 Sep 1996 08:51:06 +0200 Received: (from j@localhost) by uriah.heep.sax.de (8.7.5/8.6.9) id IAA22016; Mon, 2 Sep 1996 08:31:48 +0200 (MET DST) From: J Wunsch Message-Id: <199609020631.IAA22016@uriah.heep.sax.de> Subject: Re: Anyone mind if I remove the following braindamage from test(1)? To: freebsd-current@FreeBSD.org (FreeBSD-current users) Date: Mon, 2 Sep 1996 08:31:48 +0200 (MET DST) Cc: bde@zeta.org.au (Bruce Evans), jkh@time.cdrom.com (Jordan K. Hubbard) Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <13843.841630272@time.cdrom.com> from "Jordan K. Hubbard" at "Sep 1, 96 07:11:12 pm" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk 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. ;-)