dev-resources.site
for different kinds of informations.
Notify Yourself After Completing a Long-Running Bash Process
Recently, I worked on projects that take a long time to build. I often stared at the screen, waiting for these to complete, which often resulted in me sleeping off at my desk. Later, I improvised sleeping while listening to some podcasts, but I usually lost valuable time since I couldn't tell when the long-running tasks were done. If only I could get notified if a bash process is done.
Say hello to the "say" command
The say command takes a string of text and reads it out loud. The example below says "brew upgrade done" when you're done upgrading your brew packages.
brew upgrade; say, "brew upgrade done."
Perhaps you often sleep off while listening to one of those monotonic dialogues between Lex Fridman and Elon; you could repeat the alert until you wake up with a little sprinkle of bash.
brew upgrade; for i in {1..1000}; do; say "brew upgrade done"; done;
That would say "brew upgrade done" 1000 times unless you manually stop it(with ctrl+c).
If you don't wake up after 1000 iterations, you should close your laptop for the weekend sleep. Just sleep ๐.
โน๏ธ The say command comes preinstalled with Macos (I think), but its equivalent should be available on your Linux distro. For example, on my Ubuntu desktop installation, I have
spd-say.
Alright, that's it. Have a great weekend, you all.
Featured ones: