bug in sh?

Tim Smith tim at callan.UUCP
Wed Mar 6 06:29:16 AEST 1985


Both at callan, on System V, and at cithep, using the System III sh,
the following shell scripts do not behave as I would expect:

	Script 1			Script 2

	foo=bar				foo=bar
	echo $foo			echo $foo
	for i in x			for i in x
	do				do
		echo $foo			echo $foo
		foo=spam			foo=spam
		echo $foo			echo $foo
	done				done < /dev/null
	echo $foo			echo $foo

When run, here is the output:

	Script 1			Script 2
	$ sh script1			$ sh script2
	bar				bar
	bar				bar
	spam				spam
	spam				bar
	$				$

script1 produces the output I would expect.  Is this a bug?  Or am I
missing something?
-- 
Duty Now for the Future
					Tim Smith
			ihnp4!wlbr!callan!tim or ihnp4!cithep!tim



More information about the Comp.unix.wizards mailing list