Setting an environment variable before a command in Bash is not working for the second command in a pipe September 14, 2022 by Tarik FOO=bar bash -c 'somecommand someargs | somecommand2'