On Dec 30, 2016 11:20 PM, "Peter & Kelly Passchier" <
peterke...@passchier.net> wrote:

Thanks Dennis and Grisha! I understand.

I had thought that every line that is piped into bash is it's own shell
alignment, but I understand it's more like sourcing, so these would be
more or less equivalent, right?

r=23; echo $r; echo -e 'r=bc\necho $r' >r; source r

r=23; echo $r; echo -e 'r=bc\necho $r' |bash

Thanks again,
Peter



Not really. You're sourcing into the current shell versus piping into a
subshell.

The line you pipe in is in the current shell until it's received by the
subshell. As a result it's subject to all the evaluation that can be
performed in the current shell. Once the child shell receives it the outer
quotes will already have been stripped and if there's additional evaluation
it will then be performed.

Reply via email to