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: 3.234.143.26
To prevent spam please submit by clicking the kitten: