Timeline for How can I list all shell variables?
Current License: CC BY-SA 4.0
19 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S Mar 17, 2024 at 18:32 | history | edited | Stephen Kitt | CC BY-SA 4.0 |
Formatting, punctuation, case. No need to mention comments, changes are visible in the history.
|
| Mar 17, 2024 at 15:33 | review | Suggested edits | |||
| S Mar 17, 2024 at 18:32 | |||||
| Jul 12, 2019 at 9:30 | history | edited | Uriel | CC BY-SA 4.0 |
added 43 characters in body
|
| Nov 23, 2018 at 22:08 | history | edited | Uriel | CC BY-SA 4.0 |
completed answer thanks to comments
|
| Nov 21, 2018 at 3:59 | comment | added | user232326 |
In bash: declare -px or simply declare -x will print only exported variables.
|
|
| Sep 4, 2016 at 11:33 | history | edited | Uriel | CC BY-SA 3.0 |
added 4 characters in body
|
| Jan 3, 2015 at 0:32 | history | edited | Uriel | CC BY-SA 3.0 |
added 22 characters in body
|
| Jan 1, 2015 at 23:35 | comment | added | Barmar | I'm just trying to make the answer more accurate. For the purposes of contrasting shell variables with environment variables, it's important to distinguish between forking and execing. | |
| Jan 1, 2015 at 22:26 | comment | added | Uriel |
@Barmar Indeed, that is an interesting case. I cannot find other situations where there is no exec() after the original shell fork()s, that's why I made the shorcut about availability of environment variables. You have other cases like this in mind ?
|
|
| Dec 31, 2014 at 21:17 | comment | added | Barmar |
Try: var=1; (set). The parentheses fork a subshell. You'll see var=1 in the output.
|
|
| Dec 31, 2014 at 21:15 | comment | added | Barmar |
When a process forks, all its memory is duplicated. This includes shell variables. They're not lost until the child process calls exec to run an external program. Then only environment variables are passed.
|
|
| Dec 31, 2014 at 21:06 | comment | added | Uriel | @Barmar if shell variable are not passed, then their content is not available in child processes, no ? | |
| Dec 31, 2014 at 19:03 | comment | added | Barmar |
Shell variables are also available in child processes. The difference comes when the child process executes a new program: environment variables are passed along in exec, shell variables are not.
|
|
| Dec 27, 2014 at 19:19 | vote | accept | Josh | ||
| Dec 26, 2014 at 18:29 | comment | added | mikeserv |
set -o posix is a syntax error in most shells.
|
|
| Dec 26, 2014 at 17:35 | history | edited | Uriel | CC BY-SA 3.0 |
added @vinc17 remark regarding zsh compatibility
|
| Dec 26, 2014 at 14:33 | comment | added | vinc17 |
set -o posix doesn't exist in zsh; set doesn't output function definitions.
|
|
| Dec 26, 2014 at 14:05 | comment | added | Uriel | The question also has an answer here : stackoverflow.com/questions/1305237/… | |
| Dec 26, 2014 at 13:59 | history | answered | Uriel | CC BY-SA 3.0 |