如何将 shell 脚本输出传递给通知?

LA_*_*LA_ 5 macos shell notifications automator

我想exiftool -k -P -overwrite_original_in_place -ImageDescription= "$1"/*.ARW在通知中显示 shell 脚本运行 ( ) 的结果。我试图$1在主题中用作文本,但它显示的是 $1 而不是脚本输出。

小智 5

脚本和通知操作之间需要有一个变量设置值操作。

设置变量值接受先前操作的输入,并将其分配给具有您选择名称的变量。

然后该变量可用于其他操作。只需开始在字段中输入变量名称,它就会在自动建议中弹出。

Automator 将脚本结果作为变量传递给通知。


Lri*_*Lri 1

在 10.9 或更高版本中,您可以使用display notificationAppleScript 命令:

osascript -e 'on run {t}' -e 'display notification "" with title "t"' -e end title
Run Code Online (Sandbox Code Playgroud)

在 10.8 中你可以使用终端通知程序:

terminal-notifier -title title -message ''
Run Code Online (Sandbox Code Playgroud)

终端通知程序可以与 一起安装sudo gem install terminal-notifier