Last active
December 24, 2015 12:59
-
-
Save scottalan/6801794 to your computer and use it in GitHub Desktop.
script
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
#!/bin/bash | |
# Variables | |
rand=$RANDOM | |
web_user=$USER | |
prefix=DB_ | |
# My ENV variable is: DB_scotttest=scott-cedistage_13250 | |
# Let's say [ ${1} -e 'test' ] | |
# I'm trying to dynamically build the name of my ENV variable in my script. | |
if [ -z "${db}${web_user}${1}" ]; then | |
database=${web_user}-${1}_${rand} | |
else | |
database=$db$web_user$1 | |
fi | |
echo -e "${YELLOW}-----Database is: ${GREEN}$database${RESTORE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment