用于向Mountain Lion中的通知中心发送通知的命令行实用程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用于向Mountain Lion中的通知中心发送通知的命令行实用程序相关的知识,希望对你有一定的参考价值。

是否有任何命令行实用程序向Notification Center发送通知?类似于Growl的growlnotify

答案

看看terminal-notifier on GitHub

另一答案

在Maverics中,可以从Apple脚本触发通知,但不确定它是否适用于Mountain Lion:

display notification "Hello!"

我制作了一个简单的命令行脚本来将参数传递给Apple脚本。单线安装:

echo -e '#!/bin/bash
/usr/bin/osascript -e "display notification "$*""'|sudo -s "cd /usr/local/bin;tee notify&&chmod +x notify"

将下面的代码输出到/ usr / local / bin(必须存在)并添加可执行标志。确保/ usr / local / bin位于$ PATH中。

#! /bin/bash
/usr/bin/osascript -e "display notification "$*""

现在显示通知:

notify "Lorem ipsum dolor sit amet"
sleep 5 ; notify "Slow command finished"

以上是关于用于向Mountain Lion中的通知中心发送通知的命令行实用程序的主要内容,如果未能解决你的问题,请参考以下文章

AC3 音频不适用于带有 Perian 的 Mountain Lion

如何向 Azure 通知中心注册的每个设备发送不同的推送通知?

Mac OS X Mountain Lion 10.8 中的 Firefox X11

错误:MongoDB:未知版本:mountain_lion

OSX Mountain Lion 和 Xcode 4.4 中的网络链接调节器 Prefpane 在哪里[关闭]

OSX Mountain Lion 和 Xcode 4.4 中的网络链接调节器 Prefpane 在哪里[关闭]