Bash variables: Difference between revisions

From I Will Fear No Evil
Jump to navigation Jump to search
(Created page with "== Finding defined variables == Assuming you have done something like foo="bar" at your bash prompt it is not always clear how to echo ALL the defined variables back from your...")
(No difference)

Revision as of 12:26, 26 October 2022

Finding defined variables

Assuming you have done something like foo="bar" at your bash prompt it is not always clear how to echo ALL the defined variables back from your bash session. The following is a good way to get that information when needed. This can also be useful for debugging scripts that you are in the process of building out.

declare -p

If you only want the environment variables, and do not want to use env for some reason

declare -xp