Skip to content

Instantly share code, notes, and snippets.

@takeshixx
Created January 18, 2014 17:26
Show Gist options
  • Save takeshixx/8493530 to your computer and use it in GitHub Desktop.
Save takeshixx/8493530 to your computer and use it in GitHub Desktop.
Set proxy in a shell.
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