Background
Occasionally I need to notify myself when a long running command has finished. Here are a couple of tricks that I use to give me either a audible or visual notification.
Solution
The trick with this is to construct your command like so:
1 | % command; command-after & |
Then in the command-after position you can do things like this:
1 2 3 4 5 6 7 8 | # ring the terminal bell % tput bel # use espeak to say stuff % espeak "job's done!" # notify-send (show's a message in upper right) % notify-send "job's done!" |
1 2 | # zenity (show's a dialog box with OK button) % zenity --info --text="Job's done" |
Additionally if you want to only display a message if the command succeeds or fails you can use these patterns:
1 2 3 4 5 | # command succeeded % command && command-after & # command failed % command || command-after & |
References
NOTE: For further details regarding my one-liner blog posts, check out my one-liner style guide primer.