Created
February 15, 2024 19:46
-
-
Save angeloevangelista/cb2760988c47e5ec9cca5f00cedb3fa4 to your computer and use it in GitHub Desktop.
serialize-env-to-json-array.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for var in $(printenv); do env_arr="${env_arr}{\"key\":\"${var%%=*}\",\"value\":\"${var#*=}\"},"; done | |
export ENV_JSON=[${env_arr%,}] | |
echo "${ENV_JSON}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment