(This question is similar to this one and this one, but with the added requirement that I would like to know if variables are exported or not)
I am in bash
, Ubuntu 14.04.4 LTS. I would like to:
- list all environment variables
- for each variable, I would like to see if it is exported or not
Additionally, I would like to list only the exported environment variables.
Best Answer
Use the
declare
builtin:Accordingly:
To see just exported environment variables, use
declare -px
:Or use external commands, like
env
,printenv
, or: