Bash variables

From I Will Fear No Evil
Revision as of 12:26, 26 October 2022 by Chubbard (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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