mac push notification
有时候写脚本需要得到一个系统通知,所以如下操作
第一个terminal-notifier
? ~ echo 'Piped Message Data!' | terminal-notifier -sound default
? ~ brew install terminal-notifier
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
terminal-notifier -title ProjectX -subtitle "new tag detected" -message "Finished" -appIcon http://vjeantet.fr/images/logo.png
https://github.com/julienXX/terminal-notifier
terminal-notifier -message hello -sound default
mac上配置push notification的问题
https://github.com/julienXX/terminal-notifier
mac是否能连上苹果服务器
telnet gateway.sandbox.push.apple.com 2195
Trying 17.188.166.22...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
/usr/bin/osascript -e "display notification \"$*\""
/usr/bin/osascript -e "display notification \"ping ok\""
/usr/bin/osascript -e 'display notification "通知内容" with title "标题" subtitle "子标题"'
另一个办法:osascript
~/usr/bin/osascript -e 'display notification "ping ok" with title "ping test" subtitle "ping 192.168.1.1" sound name "Submarine"'