Timeline for posix shell: print list of environment variable names (without values)
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 25, 2018 at 20:52 | history | edited | Gilles 'SO- stop being evil' | CC BY-SA 3.0 |
added 1046 characters in body
|
| Apr 24, 2018 at 0:18 | comment | added | Juan | @StéphaneChazelas - re: embedded newline in var name - agreed - hard to defend against that with shell code. Re: AWKPATH & AWKLIBPATH pollution, I noticed that insidious insertion, too. That's gnu awk, not bsd awk. | |
| Apr 23, 2018 at 12:54 | comment | added | Stéphane Chazelas |
Note that GNU awks sets environment variables of its own (AWKPATH and AWKLIBPATH on my system)
|
|
| Apr 23, 2018 at 12:50 | comment | added | Stéphane Chazelas |
Note that if you get FOO<newline>BAR, you don't know whether it's a FOO<newline>BAR environment variable (which export -p wouldn't show with most shells, see env $'FOO\nBAR=test' awk 'BEGIN{for (v in ENVIRON) print v}') or both a FOO and BAR environment variable.
|
|
| Apr 23, 2018 at 12:50 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
exit superfluous
|
| Apr 23, 2018 at 12:34 | comment | added | Juan |
I'm not sure how "easy" it really is with sed(1) with multiline values - I'd like to see that. But thanks for the awk(1) method. I think this is the most portable way so far (although I don't think the exit is necessary).
|
|
| Apr 21, 2018 at 20:34 | history | answered | Gilles 'SO- stop being evil' | CC BY-SA 3.0 |