Skip to content

Instantly share code, notes, and snippets.

@yazdipour
Forked from arastu/proxy-switcher.sh
Created February 2, 2018 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yazdipour/58f972a8568c46edb23679de86dfec1d to your computer and use it in GitHub Desktop.
Save yazdipour/58f972a8568c46edb23679de86dfec1d to your computer and use it in GitHub Desktop.
# using:
# for set proxy:
# $ setproxy 127.0.0.1 8118
# for unset:
# $ unsetproxy
function setproxy() {
export {http,https,ftp,HTTP,HTTPS}_proxy=http://$1:$2
export no_proxy="localhost,127.0.0.1,master.cafecluster"
echo "Proxy variable(http,https,ftp) set to $1:$2"
}
function unsetproxy() {
unset {http,https,ftp,HTTP,HTTPS,no}_proxy
echo "Proxy variable(http,https,ftp) is unset!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment