Linux 設定代理指令碼
/opt/tools # vim setproxy.sh:
echo Please input your domain account and password
read -p"account:" username
read -p"password:" -s password
echo
echo Please choose a proxy server, eg: openproxy.OO.com/proxyhk.OO.com/proxyus-rd.OO.com
read -p"proxy server[proxy]:" proxy
escape_pass=`echo -ne $password| xxd -plain | tr -d '\n' | sed 's/\(..\)/%\1/g'`
export http_proxy=http://$username:[email protected]${proxy:-proxy}.OO.com:8080/
export https_proxy=$http_proxy
my_ips=`ip -f inet addr | grep global | awk '{print $2}' | awk -F/ '{print $1}' | tr '\n' ','`
host_names=`hostname -a | tr ' ' ','`
export no_proxy=127.0.0.1,.OO.com,localhost,local,.local,$my_ips$host_names
其他參考:
LINUX下PROXY設定的一般方法 http://stormzhang.com/2013/07/05/set-linux-proxy/
#proxy=http://使用者名稱:密碼@ProxyURL或IP地址:埠號
proxy=http://ProxyURL或IP地址:埠號
export http_proxy=$proxy
export https_proxy=$proxy
export ftp_proxy=$proxy
export no_proxy=以逗號分隔的除外列表