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


On 31/12/2559 11:07, Grisha Levit wrote:
> On Fri, Dec 30, 2016 at 11:03 PM, PePa <peterke...@passchier.net
> <mailto:peterke...@passchier.net>> wrote:
> 
>     r=23; echo $r; echo -e "r=bc\necho $r" |bash
> 
> You need to escape the |$| in the second echo statement so that |$r| is
> not evaluated to |23| before being echoed.
> 
> ​

Reply via email to