我在命令行中收到“语法错误:'('意外'消息。尝试将此功能设置为代理检测别名。任何帮助都将不胜感激。
function proxy-detect () {
export PROXY_IP=000.000.00.00
export PROXY_PORT=0000
proxy=$(nslookup pac.tsl.something.com 2>&1 | grep -i "name:" | grep -i "pac.tsl.something.com" )
if [ -z "$proxy" ]
then
echo 'NO PROXY'
unset http_proxy
unset https_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
git config --global --unset http.proxy
else
echo 'BEHIND PROXY'
proxy_url="http://${PROXY_IP}:${PROXY_PORT}"
export http_proxy=${proxy_url}
export https_proxy=${proxy_url}
export HTTP_PROXY=${proxy_url}
export HTTPS_PROXY=${proxy_url}
git config --global http.proxy ${proxy_url}
fi
}