Date: 13 Jun 2000 23:51:07 +0200 From: naddy@mips.inka.de (Christian Weisgerber) To: freebsd-questions@freebsd.org Subject: Re: Shell test(1) weirdness Message-ID: <8i6acb$2fmj$1@bigeye.mips.inka.de> References: <20000613134259.A4793@BSDpc.geek4food.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Andy Sparrow <andy@geek4food.org> 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. <Shrug> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8i6acb$2fmj$1>