From owner-freebsd-questions Tue Jun 13 15:30:56 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.inka.de (quechua.inka.de [212.227.14.2]) by hub.freebsd.org (Postfix) with ESMTP id B106237C0FA for ; Tue, 13 Jun 2000 15:30:49 -0700 (PDT) (envelope-from daemon@mips.inka.de) Received: from bigeye.mips.inka.de (uucp@) by mail.inka.de with local-bsmtp id 131zCn-0005ei-01; Wed, 14 Jun 2000 00:30:45 +0200 Received: (from daemon@localhost) by bigeye.mips.inka.de (8.9.3/8.9.3) id XAA81633 for freebsd-questions@freebsd.org; Tue, 13 Jun 2000 23:51:08 +0200 (CEST) (envelope-from daemon) From: naddy@mips.inka.de (Christian Weisgerber) Subject: Re: Shell test(1) weirdness Date: 13 Jun 2000 23:51:07 +0200 Message-ID: <8i6acb$2fmj$1@bigeye.mips.inka.de> References: <20000613134259.A4793@BSDpc.geek4food.org> To: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Andy Sparrow wrote: > I recently encountered a situation where the following snippet: > > #!/bin/sh > > GARBAGE= > if [ -x $GARBAGE ] > then > echo "Yup, false positive" > > Would print "Yup, false positive". If test(1) is called with a single argument, it returns true. "[ -x ]" is short for "[ -n -x ]". And I think that is rather well established and not limited to BSD. > However, I didn't write this shell script, and I'm confused as to > why I don't get a "test: argument expected" error (and a FALSE > return status) like I do on other unices, Which other unices? Oh, I see, Solaris at least. Somebody ought to check the POSIX specs. -- Christian "naddy" Weisgerber naddy@mips.inka.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message