Skip to content

Instantly share code, notes, and snippets.

@byeblogs
Forked from TerenceLiu98/autoproxy.sh
Created February 22, 2022 04:41
Show Gist options
  • Save byeblogs/9cae6f6f3cd6b3aa36c506e800aedf49 to your computer and use it in GitHub Desktop.
Save byeblogs/9cae6f6f3cd6b3aa36c506e800aedf49 to your computer and use it in GitHub Desktop.
#/bin/zsh
brew install privoxy
echo -n "<- Enter your http/https PORT ->"
read PORT
echo "PORT = $PORT"
echo "function proxy_off(){" >> ~/.bash_profile
echo " unset http_proxy" >> ~/.bash_profile
echo " unset https_proxy" >> ~/.bash_profile
echo " echo -e "已关闭代理"" ~/.bash_profile
echo "}\n" >> ~/.bash_profile
echo "function proxy_on() {" >> ~/.bash_profile
echo " export http_proxy='http://localhost:$PORT'" >> ~/.bash_profile
echo " export https_proxy='http://localhost:$PORT'" >> ~/.bash_profile
echo " echo -e "已开启代理"" >> ~/.bash_profile
echo "}" >> ~/.bash_profile
echo -n "done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment