Last active
April 9, 2020 08:46
-
-
Save jasdeepkhalsa/8b6f8179e64e002fddcef750a03dd2e6 to your computer and use it in GitHub Desktop.
Automatically determining values in a Bash 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
#!/usr/bin/env bash | |
APP=a | |
if [[ "$1" ]]; then | |
APP="$1" | |
fi | |
# This is automatically determined by the $APP variable | |
CONFIG="app-default.config" | |
case "$APP" in | |
a) | |
CONFIG="app-a.config" | |
;; | |
b) | |
CONFIG="app-b.config" | |
;; | |
*) | |
CONFIG="app-default.config" | |
;; | |
esac | |
echo -e "The app is $APP\nLoaded with config file $CONFIG" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment