Bourne Shell bug? Have a look..

Chet Ramey chet at odin.INS.CWRU.Edu
Thu Jan 17 02:29:33 AEST 1991


Paolo Ventafridda writes:

$ Please have a look at this small program written in standard
$ Bourne shell:
$ 
$ :
$ set "one two three 4"
$ if [ "`echo $@ | grep '4'" != "" ]; then 
$ 	echo "Four"
$ fi
$ 
$ 
$ Now, notice that a      `    is missing in the "if" above!
$ It works without any problems all the same: on Xenix, SCO Unix,
$ 3B2, HP-UX and i guess on any bourne shell whose sources are
$ coming from at&t.
$ It seems that only BASH gets the error.

The `standard' AT&T Bourne shell will silently add a missing
closing delimiter when it hits EOF.  I don't think ksh does,
except maybe for sh compatibility; this was listed by Korn in
his book as one of the differences between ksh and sh.  Bash
doesn't either. 

Chet

-- 
Chet Ramey				``There's just no surf in
Network Services Group			  Cleveland, U.S.A. ...''
Case Western Reserve University
chet at ins.CWRU.Edu		My opinions are just those, and mine alone.



More information about the Comp.unix.shell mailing list