Skip to content

Instantly share code, notes, and snippets.

@kazuhisya
Last active July 23, 2016 08:23
Show Gist options
  • Save kazuhisya/4b92ce653be0b5324939 to your computer and use it in GitHub Desktop.
Save kazuhisya/4b92ce653be0b5324939 to your computer and use it in GitHub Desktop.
Mac の bash で、プロキシ設定を接続ネットワークにに合わせて自動切替する

.bash_profile に以下を書く

proxy_name=http://proxy.example.com:8080
switch_trigger=hogehoge # アクセスポイントの名前


if [ "`networksetup -getairportnetwork  en0  | awk '{print $4}'`" = "$switch_trigger" ]; then
    export http_proxy=$proxy_name
    export https_proxy=$proxy_name
    export ftp_proxy=$proxy_name
    export all_proxy=$proxy_name
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment