the path to a program that should be run
Created
February 26, 2014 10:28
-
-
Save mindscratch/9227240 to your computer and use it in GitHub Desktop.
script to check for environment variables
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 | |
. /etc/init.d/functions | |
declare -a env_variables=(FOO BAR) | |
function checkVariables { | |
for var in "${env_variables[@]}" | |
do | |
if env | grep -q ^"$var=" | |
then | |
echo -n " $var: " && success | |
echo | |
else | |
echo -n " $var: " && failure | |
echo | |
echo -n " " | |
cat env_vars/$var.md | |
echo | |
fi | |
done | |
} | |
echo "Checking for environment variables:" | |
checkVariables | |
// ----------------------------------- | |
// EXAMPLE: | |
// output if FOO is set but BAR is not | |
// | |
// Checing for environment variables: | |
// FOO [ OK ] | |
// BAR [FAILED] | |
// the path to a program that should be run |
FOO specifies the number of times to run $BAR
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment