Getting notified when a job is done
I really like the interaction of the command line with more advanced user interfaces. So today I got around to finally writing a little wrapper script for the mac, that notifies me with speech output when a program has finished using the say utility. The problem I was trying to solve was getting feedback when my command line build is done. Obviously I also wanted to know whether the build was successful or not. The first solution looked like this:
./build.sh && say success || say fail |
That actually works quite nicely. But then I found it so useful, that I wrote a wrapper script, that returns an error when the wrapped program fails on top of the speech notification. It looks like this:
#!/bin/bash fail () { say fail exit 1 } eval $@ if [ $? -ne 0 ]; then fail fi say success |
After placing this as tell in my path I can just go
tell ./build.sh |
I’ve been doing this for years for long running scripts.
Try this :)
say -v “bad news” “we’re very sorry the build has really failed”
I have a very similar script, called ‘pop’, that uses (on Linux) xosd-cat to pop up a message in red or green text. I find it indispensable.