Date: Tue, 28 Dec 1999 12:34:35 +0100 From: Martin Cracauer <cracauer@cons.org> To: Marcin Cieslak <saper@system.pl> Cc: freebsd-stable@FreeBSD.ORG Subject: Re: /bin/test broken ? Message-ID: <19991228123435.A37738@cons.org> In-Reply-To: <owner-freebsd-stableATFreeBSD.ORG--Pine.GSO.4.20.9912231402460.18183-100000@tricord.system.pl>; from Marcin Cieslak on Thu, Dec 23, 1999 at 02:30:19PM %2B0100 References: <Pine.BSF.4.05.9912230044370.27298-100000@bsd1.nyct.net> <owner-freebsd-stableATFreeBSD.ORG--Pine.GSO.4.20.9912231402460.18183-100000@tricord.system.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
In <owner-freebsd-stableATFreeBSD.ORG--Pine.GSO.4.20.9912231402460.18183-100000@tricord.system.pl>, Marcin Cieslak wrote: > On Thu, 23 Dec 1999, Eric D. Futch wrote: > > > -stable as of Wed Dec 22 01:48:17 EST 1999 dosen't seem to have this > > problem. > > > > % /bin/test 1 -ne 0 ] > > test: ]: unexpected operator > > Recent -stable: > > $ /bin/test 1 -ne 0 ] > test: syntax error > $ [ 1 -ne 0 ] > $ > > but on Solaris 2.5 in both sh and ksh: > > $ /bin/test 1 -ne 0 ] > $ [ 1 -ne 0 ] Posix makes it clear that `test -n` without further arguments should be interpreted as "yes, there is a string with length > 0, and it is a dash and an n". Solaris violates this rule, amoung other problems. Also, try this on Solaris: sh -c 'test -n ; echo This must appear no matter what the former did' ksh -c 'test -n ; echo This must appear no matter what the former did' Probably caused by a shared source for standalone test(1) and sh's test(1). Someone calls exit() on error in test(1), and doesn't take into account that it may be builtin in sh. See also http://www3.cons.org/cracauer/bourneshell.html under "Fun with test -n". This is a beta-test page, feedback welcome. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer <cracauer@bik-gmbh.de> http://www.bik-gmbh.de/~cracauer/ "Where do you want to do today?" Hard to tell running your calendar program on a junk operating system, eh? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991228123435.A37738>