[net.unix-wizards] /bin/sh feature? --- more lossage

bruce@godot.UUCP (Bruce Nemnich) (07/14/84)

Funny you should mention this, since I got bit by a related feature just
today when trying to unpack a shar with /bin/sh:

	echo >foo <<eof
	line 1
	line 2 `hi`
	line 3
	eof

Yes, the backquote in inline input redirecton is active; it will try to
execute the hi command and lose.  Sigh.

-- 
--Bruce Nemnich, Thinking Machines Corporation, Waltham, MA
  {astrovax,cca,escher,ihnp4,ima,mit-eddie,...}!godot!bruce, BJN@MIT-MC.ARPA

bruce@godot.UUCP (Bruce Nemnich) (07/15/84)

Before everyone rushes to respond to my blunder, I now realize the word
in the << redirection must be quoted in order for the redirected text to
be passed literally.  I'm surprised I've never been schrod by that before.
-- 
--Bruce Nemnich, Thinking Machines Corporation, Waltham, MA
  {astrovax,cca,escher,ihnp4,ima,mit-eddie,...}!godot!bruce, BJN@MIT-MC.ARPA

mike@hcrvax.UUCP (Mike Tilson) (07/15/84)

The following will print your working directory:

	cat <<eof
	`pwd`
	eof

while this will print the line "`pwd`":

	cat <<\eof
	`pwd`
	eof

as documented in sh(1) in the System V programmer's manual.

bsafw@ncoast.UUCP (07/31/84)

	The manual for /bin/sh states (on our system, at least) that $ and `
are BOTH active in here documents UNLESS the EOF string is quoted.  The shar
maker script I wrote on our system uses this to its advantage.  BTW, I have
made good use of both $ and ` in here documents -- it's far from a useless
kludge.
-- 
		Brandon Allbery: decvax!cwruecmp{!atvax}!bsafw
		  6504 Chestnut Road, Independence, OH 44131

		  Witness, n.  To watch and learn, joyously.