A couple of days ago, I typed in the following one-liner:
$ sleeptil -v 19:00; while [[ -z $(chk-jtv-lives.sh) ]]; do sleep 1m; done; beeps Thu Dec 27 19:00:00 CST 2012 in 37 minutes 18 seconds
What it did was:
- Wait until 7 PM using sleeptil,
- Check chk-jtv-lives.sh if it outputs anything,
- If not, sleep for one minute, then go to #2,
- If yes, leaves the loop, and runs beeps.
There is a channel which broadcasts around 7:30 PM every day, sometimes, it does, sometimes, it doesn’t. I don’t need to check or keep press refresh button to know if the stream is live or run that checking script. Just let this one-liner run and I will hear beeping noise when the stream goes live.
When I wrote those scrips and functions, I didn’t know one day I would use all of them in a one-liner. No need for a special app or browser add-on, just piece together a few codes that I have written and I have a unique and custom-made notifier.
It may not look epic or fancy as any other notifier, but it tells me: When you write a useful code and you will know it eventually. Not only it helps you but also saves your time.
I really like shell scripting, you can use Bash to do many tasks. Oftentimes, a simple one-liner does the task perfectly, and that makes you feel great.
Have you had similar experience?