Bash environment variables

If you want to pull an environment variable into a bash script do

foo=$ENV_FOO;

To do the same, but assign foo a default value if there is no environment variable

foo=${ENV_FOO:-my_default_value}

Note: the - preceding the default value is required.



Note: Replies will be formatted with PHP Markdown Extra syntax.

Name: Email (Not Required):
 
Logged IP: 52.14.22.250
To prevent spam please submit by clicking the kitten: