Skip to content

Instantly share code, notes, and snippets.

@brainv
Forked from takeshixx/gist:8493530
Created April 12, 2014 19:14
Show Gist options
  • Select an option

  • Save brainv/10551760 to your computer and use it in GitHub Desktop.

Select an option

Save brainv/10551760 to your computer and use it in GitHub Desktop.
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