]> code.delx.au - osx-proxyconf/blob - proxyconf.sh
Also print out no_proxy environment variable
[osx-proxyconf] / proxyconf.sh
1 #!/bin/bash
2
3 if [ "$(sysconfig -q "HTTPEnable")" = "1" ]; then
4 host="$(sysconfig -q "HTTPProxy")"
5 port="$(sysconfig -q "HTTPPort")"
6 echo "export http_proxy=\"http://${host}:${port}\""
7 fi
8 if [ "$(sysconfig -q "HTTPSEnable")" = "1" ]; then
9 host="$(sysconfig -q "HTTPSProxy")"
10 port="$(sysconfig -q "HTTPSPort")"
11 echo "export https_proxy=\"http://${host}:${port}\""
12 fi
13 if [ "$(sysconfig -q "FTPEnable")" = "1" ]; then
14 host="$(sysconfig -q "FTPProxy")"
15 port="$(sysconfig -q "FTPPort")"
16 echo "export ftp_proxy=\"http://${host}:${port}\""
17 fi
18 if [ -n "${host}" ]; then
19 no_proxy="$(sysconfig ExceptionsList | tr '\n' ',' | sed 's/,$//g')"
20 echo "export no_proxy=\"${no_proxy}\""
21 fi