The bourne shell again ( summary and question )
Henry Spencer
henry at utzoo.UUCP
Wed Apr 3 08:58:23 AEST 1985
> number=one
> while something
> do
> number=two
> done < TheLarch
>
> 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.
The quick answer is, it should. If you interpose a shell function
(only found in more recent Bourne shells) between the loop and the
redirection, it does it right. When redirection of builtin commands
was added to the shell -- post-V7 -- all the machinery that would be
needed was added. It just hasn't been applied to this case yet.
--
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!henry
More information about the Comp.unix.wizards
mailing list