Export variable to `/ bin / bash -c`
1 answer
Since you are specifying the command twice,
$FOO
got evaluated in your current shell, not /bin/bash -c
. That is, what was actually accomplished was the following:
/bin/bash -c 'export FOO=foo; echo '
Enclose in single quotes:
/bin/bash -c 'export FOO=foo; echo $FOO'
equivalent shorter form:
FOO=foo /bin/bash -c 'echo $FOO'
+3
source to share