Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How could I pass shell script output to notification?

I would like to show result of shell script run (exiftool -k -P -overwrite_original_in_place -ImageDescription= "$1"/*.ARW) in notification. I've tried to use $1 as text in the subject, but it shows exactly $1 instead of script output.

like image 539
LA_ Avatar asked Oct 20 '22 21:10

LA_


2 Answers

There needs to be a Set Value of Variable action in between the script and notification actions.

Set Value of Variable accepts input from previous action and assigns it to a variable with the name of your choice.

This variable is then available for other actions. Just start typing the name of the variable in a field and it should pop-up in the auto-suggestion.

Automator pass script result to notification as variable.

like image 165
Michal Mau Avatar answered Oct 31 '22 16:10

Michal Mau


In 10.9 or later, you can use the display notification AppleScript command:

osascript -e 'on run {t}' -e 'display notification "" with title "t"' -e end title

In 10.8 you can use terminal-notifier:

terminal-notifier -title title -message ''

terminal-notifier can be installed with sudo gem install terminal-notifier.

like image 29
Lri Avatar answered Oct 31 '22 18:10

Lri