bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug? Explanation??


From: Dennis Williamson
Subject: Re: Bug? Explanation??
Date: Fri, 30 Dec 2016 22:29:28 -0600



On Dec 30, 2016 11:20 PM, "Peter & Kelly Passchier" <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]