Last active
February 5, 2020 09:19
-
-
Save idiomer/c808f86b9a06e2e9b9c1a7dd16e019c4 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
deactive_proxy () { | |
if [ ! "$1" = "nondestructive" ] ; then | |
unset -f deactive_proxy | |
if [ -n "$_OLD_HTTP_PROXY" ] ; then | |
http_proxy="$_OLD_HTTP_PROXY" | |
export http_proxy | |
unset _OLD_HTTP_PROXY | |
else | |
unset http_proxy | |
fi | |
if [ -n "$_OLD_HTTPS_PROXY" ] ; then | |
https_proxy="$_OLD_HTTPS_PROXY" | |
export https_proxy | |
unset _OLD_HTTPS_PROXY | |
else | |
unset https_proxy | |
fi | |
fi | |
} | |
deactive_proxy nondestructive | |
if [ -n "$http_proxy" ] ; then | |
_OLD_HTTP_PROXY="$http_proxy" | |
export _OLD_HTTP_PROXY | |
unset http_proxy | |
fi | |
if [ -n "$https_proxy" ] ; then | |
_OLD_HTTPS_PROXY="$https_proxy" | |
export _OLD_HTTPS_PROXY | |
unset https_proxy | |
fi | |
port="1090" | |
host="192.168.0.103" | |
http_proxy=http://${host}:${port} | |
https_proxy=http://${host}:${port} | |
export http_proxy | |
export https_proxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
active proxy
source active_proxy.sh
deactive proxy
deactive_proxy