Shell tips and tricks

Ben Scott dragonhawk at gmail.com
Thu Nov 1 13:09:00 EDT 2007


On 11/1/07, VirginSnow at vfemail.net <VirginSnow at vfemail.net> wrote:
> The difference is that this (this whole example) is run in the same
> subshell.

  Sheesh.  That makes even less sense to me.  Let me see if I have
this right.  Two examples:

	foo | while read LINE ; do bar ; i=$(( i + 1 )) ; done

	while read LINE ; do bar ; i=$(( i + 1 )) ; done < <(foo)

The first results in the "do clause" being run in a subshell, while
the second does not?  Why is that?  In both cases, we're sending
output from one process into the shell's internal "read" builtin.  Is
there any rhyme or reason to this?

>  done | grep ^MAGIC | tail -n 1 |

  *vomit*

  The things we do to work around stupid limitations...

-- Ben


More information about the gnhlug-discuss mailing list