Created
June 23, 2020 09:22
-
-
Save gerritjvv/c88177e2b98e4d56265431f7a21d8204 to your computer and use it in GitHub Desktop.
Update variables with a PROD Prefix in bash
This file contains hidden or 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
# The aim is to support e.g | |
# URL="dburl" variables and then override at will when PROD_URL is available. | |
switch_prod.sh | |
for v in $(env | awk '/PROD_/ {gsub(/PROD_/,""); print $1}'); do | |
eval "export $v" | |
done | |
#call using must use . to source the file, otherwise the environment variables set | |
# are not seen by the parent process | |
. ./switch-prod.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment