6 ms·
I could be wrong but I don't think you can set shell variables from the pipe, right? echo "export FOO=bar" | bash echo $FOO I am trying to set the var
by apatheticonion 1y ago
I could be wrong but I don't think you can set shell variables from the pipe, right?
echo "export FOO=bar" | bash
echo $FOO
I am trying to set the variables in the current shell
eval $(echo "echo 'export FOO=bar'" | bash)
echo $FOO
So my script writes variables to stdout and redirects everything else to stderr. I use this to update a `.bashrc` while also updating the current shell