🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: sublink.lang.shell
1 messages
1 total messages Started by Brandon S. Allbery KB8JRR Wed, 23 Jan 1991 04:34
Re: Bourne Shell bug? Have a look..
#1
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads