unset v function f { v=1 } f | cat echo v=$v f echo v=$v
Why does piping (to any command) prevent the first echo command from printing 1? The second echo prints 1. I'm using a bash shell. I can see this by copy/paste or by running this as a script.