Path: utzoo!utgpu!watserv1!watmath!uunet!dino!sharkey!itivax!scs From: scs@iti.org (Steve Simmons) Newsgroups: unix-pc.general Subject: Re: YAkshBug Keywords: ksh bug Message-ID: <4886@itivax.iti.org> Date: 2 Feb 90 21:02:33 GMT References: <682@uncle.UUCP> Sender: news@itivax.iti.org Lines: 28 jbm@uncle.UUCP (John B. Milton) writes: >Well, bug or inconsistancy: >if [ -f * ]; then echo yes; fi >will print "yes" if there are one or more files when using /bin/sh, but >not with ksh. Ksh gives a syntax error. >if sh -c "test -f *"; then echo yes; fi >Does work. Inconsistancy. Strictly speaking if [ -f a b ] ; then . . . is incorrect. The '-f' test takes one and only one arguement. /bin/sh silently ignores the extra, while /bin/ksh reports the error. My source on this is David Korn. Interestingly enough, what would if [ -f a b -a -f c ] ; then ... do? How many arguements does sh ignore, and which ones? 'if [ -f a b ]' is definately a shell bug waiting to happen, and while it was disturbing to find the inconsistancy between the two I'd much prefer the error notice. Steve