News for hackers. Stuff that matters.
Re:My Favorite One Liners by chrisshroba on Monday May 03, 2021 @10:39AM (#27025643)
A slightly upgraded bash/zsh function for displaying a notification:

  noti() {
    osascript -e \
      'on run argv
        display notification (item 1 of argv) with title "Notification"
       end run' \
      $1
  }

  # Example:
  noti 'Hello world!'
This fixes any escaping issues by passing the notification string to osascript as an argument instead of embedding it in the text of the program (which makes things like quotation marks not work correctly).

Sticking it in your .bashrc or .zshrc will make it available at any time in your shell.

There are no comments on this comment yet.