Automator Proxy Toggle Shell

人都是被逼出来的,为翻墙方便,用Automator写了一个Service,就执行一段shell,还设置了一个快捷键。

#!/bin/sh
STAT=`sudo networksetup -getwebproxy Ethernet | head -1 | cut -d: -f 2|sed 's/ //g'`
if [ "$STAT" == "No" ];then
networksetup -setwebproxystate Ethernet on;
/Users/guixing/bin/growlnotify -m "Proxy On";
else
networksetup -setwebproxystate Ethernet off;
/Users/guixing/bin/growlnotify -m "Proxy Off";
fi

growlnotify是Growl的一个命令行工具。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.