Ash internal 'read' command and pipes

Harald Becker ralda at gmx.de
Wed Oct 9 13:52:17 UTC 2013


Hi  !

>  $ echo something | read something
>is as if written like:
>  $ echo something | ( read something )

In principial yes, but second example may fork another subshell.
First is required due to piping, second due to parentheses.

>Same as grouping commands with braces (curly or parenthesis), I
>suppose...

Yes. Braces signal the shell to translate all commands in it's
internal form and then execute them as once in the same subshell
(except if the commands itself require further subshell forking).

>Yeah! I know I have to be cautious mostly with variables when I
>test commands in the interactive shell. I tried that before
>posting, in case the 'interactivity' was messing all.

It is the same, why any command you start from a shell, can't
modify the variables of the shell. In Microsoft systems you have
a single shell, handling all commands. In Unix/POSIX like systems
shells are normal programs. Each shell reads it's commands and
works on it's own set of variables (as each process has it's own
memory space).

>P.S. I am not a Windows guy from at least 6 years now!

Great, another intelligent user ;-) ... I did not use Windows
machines for around 18 years now. 

--
Harald


More information about the busybox mailing list