How to output all ENV VARs and their values?

Following a shell to achieve this goal


# Loop over all environment variables
for var in $(compgen -v); do
    # Print the variable name and its value
    echo "$var=${!var}"

Please be cautious about where and when you run this, as it could expose sensitive data in your environment variables.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s