Timeline for How to list all variables names and their current values?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 22, 2023 at 11:49 | comment | added | Eljay | @DJCrashdummy • I don't know why that is. My guess is the programmer for those things did not think it was useful, and hence the various strategies (or workarounds) to get that information. | |
Jun 22, 2023 at 10:53 | comment | added | DJCrashdummy |
@Eljay well... at least for me declare -p "includes" resp. lists them all (and FUNCNAME additionally), but you are kind of right: the values are not shown and also values of arrays are not shown. do you know why this is? -- so IMHO your line is the most comprehensive way to do this, even with all values of arrays including indexes!
|
|
Jun 15, 2023 at 11:05 | comment | added | Eljay |
@DJCrashdummy • declare -p won't include things like BASH_COMMAND , BASH_SUBSHELL , COMP_WORDBREAKS , HISTCMD , LINENO , RANDOM , SECONDS .
|
|
Jun 15, 2023 at 8:13 | comment | added | DJCrashdummy |
@Eljay what is the difference to just declare -p ?
|
|
Dec 13, 2018 at 17:58 | comment | added | Eljay |
A variant: compgen -v | while read line; do declare -p $line; done
|
|
Nov 9, 2017 at 15:20 | comment | added | Mene | This should be the accepted answer, as all others list more than just the name itself. In my case some variables contain multiline values which makes the other solutions not feasable. | |
Dec 25, 2016 at 19:07 | review | Suggested edits | |||
Dec 25, 2016 at 20:32 | |||||
S Apr 11, 2014 at 21:12 | review | Low quality posts | |||
Apr 11, 2014 at 21:27 | |||||
S Apr 11, 2014 at 21:12 | review | Late answers | |||
Apr 11, 2014 at 21:15 | |||||
S Apr 11, 2014 at 21:12 | review | First posts | |||
Apr 11, 2014 at 21:23 | |||||
Apr 11, 2014 at 21:07 | history | edited | Seth | CC BY-SA 3.0 |
edited body
|
Apr 11, 2014 at 20:53 | history | answered | tmgoblin | CC BY-SA 3.0 |