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
21 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 27 at 7:33 | answer | added | fflores | timeline score: 0 | |
Nov 24, 2022 at 12:24 | comment | added | user2138149 |
In other words: (export foo="hello") , echo $foo prints a blank line, showing that foo is not set outside of the subshell.
|
|
Nov 24, 2022 at 12:23 | comment | added | user2138149 |
Why don't you want to use export provided that a side effect is not to pollute your environment? In other words, why does it matter if export is used if the variable is not set after the command(s) finish executing. eg: In a subshell.
|
|
S Aug 15, 2022 at 14:24 | history | suggested | Jamiu S. | CC BY-SA 4.0 |
Improved formatting
|
Aug 15, 2022 at 12:32 | review | Suggested edits | |||
S Aug 15, 2022 at 14:24 | |||||
Jun 20, 2020 at 7:50 | answer | added | Akhil | timeline score: 28 | |
Mar 4, 2020 at 19:32 | history | edited | Peter Mortensen | CC BY-SA 4.0 |
Active reading [<https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29>].
|
Jun 26, 2019 at 4:19 | answer | added | benjimin | timeline score: 82 | |
Oct 18, 2017 at 15:56 | comment | added | Brecht Machiels | The why is explained here: stackoverflow.com/questions/13998075/… | |
Oct 18, 2017 at 11:03 | comment | added | Brecht Machiels | I was hoping one of the answers would also explain why this only sort of works, i.e. why it's not equivalent to exporting the variable before the call. | |
Sep 19, 2017 at 7:34 | comment | added | Frank N | In the context of cross-platform (incl. windows) scripts or npm-based projects (js or else), you might want to take a look at the cross-env module. | |
Dec 5, 2015 at 7:39 | answer | added | gniourf_gniourf | timeline score: 63 | |
Nov 3, 2015 at 12:28 | comment | added | vp_arth |
(T=$(date) echo $T) will work
|
|
May 16, 2014 at 16:11 | history | edited | Stephen Ostermiller♦ | CC BY-SA 3.0 |
Better indication of when the problem actually occurs
|
Jun 3, 2012 at 8:19 | history | edited | MartyMacGyver | CC BY-SA 3.0 |
added 75 characters in body
|
Jun 1, 2012 at 19:54 | history | edited | MartyMacGyver | CC BY-SA 3.0 |
added 236 characters in body
|
Jun 1, 2012 at 19:49 | vote | accept | MartyMacGyver | ||
Jun 1, 2012 at 19:40 | answer | added | Spencer Rathbun | timeline score: -7 | |
Jun 1, 2012 at 19:39 | answer | added | Dennis Williamson | timeline score: 495 | |
Jun 1, 2012 at 19:25 | answer | added | 0xC0000022L | timeline score: 335 | |
Jun 1, 2012 at 19:17 | history | asked | MartyMacGyver | CC BY-SA 3.0 |