🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sublink.lang.shell
Article #1

Re: Bourne Shell bug? Have a look..

#1
From: Brandon S. Allbery KB8JRR
Date: Wed, 23 Jan 1991 04:34
35 lines
2001 bytes
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
Technical Details
Message-ID: <1991Jan23.043418.4618@NCoast.ORG>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery
References: <1174@otello.sublink.org> <1991Jan16.152933.7288@usenet.ins.cwru.edu> <1991Jan16.153557.15548@ms.uky.edu>

Show Full Headers
Complete Article Headers
Message-ID: <1991Jan23.043418.4618@NCoast.ORG>
Subject: Re: Bourne Shell bug? Have a look..
Date: Wed, 23 Jan 1991 04:34:18 +0000
From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR)
References: <1174@otello.sublink.org> <1991Jan16.152933.7288@usenet.ins.cwru.edu> <1991Jan16.153557.15548@ms.uky.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!usenet.ins.cwru.edu!ncoast!allbery
Newsgroups: comp.unix.shell,sublink.lang.shell
Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR)
Followup-To: comp.unix.shell
Organization: North Coast Computer Resources (ncoast)
Lines: 34