Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.unix.shell,sublink.lang.shell Subject: Re: Bourne Shell bug? Have a look.. Message-ID: <1991Jan23.043418.4618@NCoast.ORG> Date: 23 Jan 91 04:34:18 GMT References: <1174@otello.sublink.org> <1991Jan16.152933.7288@usenet.ins.cwru.edu> <1991Jan16.153557.15548@ms.uky.edu> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.unix.shell Organization: North Coast Computer Resources (ncoast) Lines: 34 As quoted from <1991Jan16.153557.15548@ms.uky.edu> by morgan@ms.uky.edu (Wes Morgan): +--------------- | chet@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, | | 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 +--------------- Precedence doesn't play a part in it; the " is seen first, so the "word splitter" scans to the next un-escaped ". Thus, it gets the string: `echo $@ | grep '4' When it later scans that string, it discovers the unbalanced ` and inserts one at the end. ++Brandon -- Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440 Internet: allbery@NCoast.ORG Packet: KB8JRR @ WA8BXN America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY