Timeline for Setting an environment variable before a command in Bash is not working for the second command in a pipe
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 9, 2022 at 19:50 | comment | added | Alireza Mohamadi | @KeithThompson Your comment had something new to teach me. I never thought of shell vs environment variables. I used to think of global vs local environment variables. Now I know the correct terminology. | |
Mar 4, 2020 at 19:33 | history | edited | Peter Mortensen | CC BY-SA 4.0 |
More affirmative answer (this is not a forum - see e.g. <http://meta.stackexchange.com/a/92115>. It is a think tank (see <http://meta.stackoverflow.com/a/325681>).
|
Dec 11, 2015 at 21:28 | review | Low quality answers | |||
Dec 12, 2015 at 4:22 | |||||
Jun 1, 2012 at 19:47 | comment | added | MartyMacGyver | It'd work but it defeats the purpose of having a one-line command (I'm trying to learn more creative ways to avoid multi-liners and/or scripts for relatively simple cases). And what @Keith said, though at least the export would stay scoped to the script. | |
Jun 1, 2012 at 19:41 | comment | added | Keith Thompson |
You still need export ; otherwise $FOO will be a shell variable, not an environment variable, and therefore not visible to somecommand or somecommand2 .
|
|
Jun 1, 2012 at 19:40 | history | answered | Spencer Rathbun | CC BY-SA 3.0 |