Created
July 10, 2014 17:56
-
-
Save fixlr/e57b75952c49a13b6b6a to your computer and use it in GitHub Desktop.
Shell alias to toggle an environment variable. All variable names have been changed to protect the innocent.
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
alias toggle_my_env_variable='[ -z "$MY_ENV_VARIABLE" ] \ | |
&& export MY_ENV_VARIABLE=true \ | |
|| unset MY_ENV_VARIABLE; \ | |
[ -z "$MY_ENV_VARIABLE" ] \ | |
&& echo "MY_ENV_VARIABLE if OFF" \ | |
|| echo "MY_ENV_VARIABLE is ON"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment