Bourne Shell bug? Have a look..

Wes Morgan morgan at ms.uky.edu
Thu Jan 17 02:35:57 AEST 1991


chet at po.CWRU.Edu writes:
>Paolo Ventafridda writes:
>
>$ :
>$ set "one two three 4"
>$ if [ "`echo $@ | grep '4'" != "" ]; then 
>$ 	echo "Four"
>$ fi
>$ 
>
>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. 

Hmmmmm.....if it added the delimiter when it hit EOF, wouldn't
it put it at the end of the script, giving an "unexpected end
of file" error?   I had thought that this might be a precedence
problem.  If sh(1) assigned a higher precedence to " than to `
or ', wouldn't it insert it at the appropriate place?  I tested
this, and the script above works with missing ' as well as with
missing " or `..........

The FM on this system doesn't give a precedence listing for
metacharacters in sh(1); does such a beast exist?

Curious,
Wes


-- 
    | Wes Morgan, not speaking for | {any major site}!ukma!ukecc!morgan | 
    | the University of Kentucky's |        morgan at engr.uky.edu         |
    | Engineering Computing Center |   morgan%engr.uky.edu at UKCC.BITNET  | 
     Lint is the compiler's only means of dampening the programmer's ego.



More information about the Comp.unix.shell mailing list