Created
January 18, 2014 17:26
-
-
Save takeshixx/8493530 to your computer and use it in GitHub Desktop.
Set proxy in a shell.
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
function proxy () { | |
UNSET="" | |
PROXY="http://127.0.0.1:8080" | |
PROXY_ENV=(http_proxy https_proxy ftp_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY) | |
if [ $1 == on ]; then | |
for i in $PROXY_ENV; do | |
export $i=$PROXY | |
done | |
echo "proxy set" | |
elif [ $1 == off ]; then | |
for i in $PORXY_ENV; do | |
unset $i | |
done | |
echo "proxy unset" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment