zsh功能不起作用 - ubuntu终端

时间:2014-05-09 14:38:43

标签: linux function terminal zsh zshrc

我在命令行中收到“语法错误:'('意外'消息。尝试将此功能设置为代理检测别名。任何帮助都将不胜感激。

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
  }

0 个答案:

没有答案