Ash eval wierdness

Rich Felker dalias at aerifal.cx
Wed May 25 16:18:03 UTC 2011


On Wed, May 25, 2011 at 04:33:56PM +0200, Yann E. MORIN wrote:
> > echo "myvar=my value" | while read opt; do 
[...]
> 
> That's expected. All that is to the right part of the pipe is running in a
> sub-shell. So the evaluation is done in a sub-shell. So it is lost as soon
> as this sub-shell ends.

The canonical solution is:

while read opt; do ... ; done << EOF
myvar=my value
EOF

Rich


More information about the busybox mailing list