How to output all ENV VARs and their values?

Following a shell to achieve this goal

#!/bin/bash

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

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:

WordPress.com Logo

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

Facebook photo

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

Connecting to %s