Skip to content

Instantly share code, notes, and snippets.

@googya
Created September 21, 2016 01:34
Show Gist options
  • Save googya/7b02763d57f6e7964815da6769e6a745 to your computer and use it in GitHub Desktop.
Save googya/7b02763d57f6e7964815da6769e6a745 to your computer and use it in GitHub Desktop.
Enable or disable ENV variables.
#!/bin/bash
# . script.sh # identical to "source script.sh"
if [ $# -eq 0 ]
then
echo "No arguments supplied"
fi
if [ $# -eq 1 ]
then
if [[ "$1" = "--set" ]]
then
echo "foo is set"
export NO_PROXY=localhost,127.0.0.0/8,::1
export ALL_PROXY=socks://proxy.foo.it:8080/
export HTTP_PROXY=http://proxy.foo.it:8080/
export HTTPS_PROXY=https://proxy.foo.it:8080/
export FTP_PROXY=ftp://proxy.foo.it:8080/
export SOCK_PROXY=socks://proxy.foo.it:8080/
fi
if [[ "$1" = "--unset" ]]
then
echo "foo is unset"
export NO_PROXY=localhost,127.0.0.0/8,::1
unset ALL_PROXY
unset HTTP_PROXY
unset HTTPS_PROXY
unset FTP_PROXY
unset SOCK_PROXY
fi
else
echo "Usage $0 [--set | --unset]"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment