bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sub shell mit pipes


From: Paul Jarc
Subject: Re: Sub shell mit pipes
Date: Wed, 11 Aug 2004 15:29:30 -0400
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux)

Enrique Perez-Terron <enrio@online.no> wrote:
> Is there any formal requirement dictating that the 'while' statement
> shall be executed in a sub-shell?

Not that I can find, but I imagine it makes the code simpler.

> The semantics I would like to see is that in a pipeline, the last
> component that is not an external program is executed in the main shell.

That doesn't seem like a good idea.  bash would have to inspect each
command deeply to see what will be done before it could decide how to
do it.  It could also be surprising for the programmer.  One shell's
builtin may be another's external command.

> I would even prefer the additional rule that if one or more of the
> members of a pipeline are statements enclosed in braces ({}), the last
> of these is done in the main shell

New behavior is best implemented with new syntax, so as not to change
the meaning of existing code, and to make the meaning new code more
obvious to the reader.

> commands_1 | exec | commands_2

You can do that now, but it's spelled differently:
exec < <(commands_1) > >(commands_2)


paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]