vjeantet / alerter

Send User Alert Notification on Mac OS X from the command-line.
MIT License
936 stars 62 forks source link

How to call alerter from script without blocking? #43

Open dakshin-k opened 3 years ago

dakshin-k commented 3 years ago

Hi,

I'm trying to trigger a notification from inside a bash script, however I do not want the script to wait for a user to click on the notification. I want the script to fire the notification and then continue on to the next line.

I haven't been able to find a way to achieve this by going through the help message of the command - The closest solution I could find was to use the timeout flag, which still causes the script to be blocked for that many seconds.

Can someone please point me in the right direction?

dakshin-k commented 3 years ago

This StackOverflow answer gave me the idea of wrapping the command in parantheses like so:

(alerter -message hello &>/dev/null &)

But I feel this isn't the best way to do it and it would be good if alerter had an option to send notifications silently

term-i-nator commented 10 months ago

...a very old question, but...

To continue with the script I use the "disown" command with alerter to throw it into its own independent (background-)process:

alerter -message "Hello World" > /dev/null & disown

With "disown" the message stays on screen even if the script ends.