Ash internal 'read' command and pipes

Laurent Bercot ska-dietlibc at skarnet.org
Wed Oct 9 15:51:20 UTC 2013


> 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.

  Shameless plug: execline is always very clear about what forks and
what does not, and since no interpreter is running while the script
is executing, it obsoletes the very notion of "subshell".

-- 
  Laurent



More information about the busybox mailing list