Ash internal 'read' command and pipes
Denys Vlasenko
vda.linux at googlemail.com
Sat Oct 12 01:36:40 UTC 2013
On Wednesday 09 October 2013 17:51, Laurent Bercot wrote:
>
> > you will see the values of your variables doesn't change when
> > commands run in a subshell ... and piping informations always
> > means passing data between separate processes, so it forces the
> > command to be run in its own subshell.
>
> You have to admit that it is not intuitive or user-friendly, to
> say the least. It goes against the principle of least surprise :
> the shell behaviour changes depending on something that is not
> at all immediately obvious to the user, and worse, that the shell
> language is actively trying to hide : subshells are forked silently,
> as if it was something shameful - and considering the hefty amount
> of resources used in forking a shell, *it is*; but it is not so
> silent when users experience bugs because running a command in the
> main shell is not the same thing as running it in a subshell.
Shell wasn't meant to be a general purpose programming language.
I suppose it started as a means to run a few commands in sequence,
then it grew more features as necessary.
The end result is a quite awkward language. For one: which other
language would care about whitespace in assignment operations? -
a=b
a= b
a =b
a = b
In shells, only the first form is ok.
More information about the busybox
mailing list