The bourne shell again ( summary and question )

Tim Smith tim at cithep.UucP
Sun Mar 31 21:09:03 AEST 1985


Ok, I see why

	if true
		x
		y
		z
	fi

runs all but the last command in a subshell.  I should have
realized that.  But I have still not received an explanation
for the first problem I had.  That concerned this construct:

	number=one
	while something
	do
		number=two
	done < TheLarch

I wondered why the assignment in the loop was not done.  Several people
correctly pointed out that the body of the loop is done in a subshell,
so the assignment does not show up outside the loop.  Ok, fine.  And now
the question.

Why is the body of the loop done in a subshell?  Could it
not use dup() to save the current stdin, and put it back after
the loop?  This is crtainly what I expected.

If you feel like answering this, and are one of the following people,
please post to the net to settle this once and for all:

	Goug Gwyn, Guy Harris, Henry Spencer, Chris Torek, Norman Wilson

Otherwise, mail rather than post!
-- 
Duty Now for the Future

					Tim Smith
				ihnp4!{wlbr!callan,cithep}!tim



More information about the Comp.unix.wizards mailing list