News for hackers. Stuff that matters.
Re:My Favorite One Liners by m-hilgendorf on Monday May 03, 2021 @11:04AM (#27025983)
On MacOS

   ./very-long-task.sh && say 'success' || say 'fail'
I use it when I need to context switch and leave something running. `espeak` is an alternative for `say` on Linuxes.
Re:My Favorite One Liners by j1elo on Monday May 03, 2021 @02:45PM (#27029061)
Note ShellCheck's SC2015, especially if you do stuff with permanent consequences in the place of "say":

"A && B || C is not if-then-else. C may run when A is true":

https://github.com/koalaman/shellcheck/wiki/SC2015

Re:My Favorite One Liners by yesenadam on Monday May 03, 2021 @08:05PM (#27032518)
Interesting! Good to know, thanks. I never mix && and || in the same line, but didn't know exactly why that is!

The problem is that "In this case, if A is true but B is false, C will run."

I guess with B as "say", B will never be false, but generally it's really not the same as if-then-else.

Re:My Favorite One Liners by banana_giraffe on Monday May 03, 2021 @11:23AM (#27026271)
I like this idea a lot, I just dumped a tiny shell script named 'tellme' on my mac:

    #!/bin/bash
    $@ && say 'The command finished.' || say 'Danger!  Something blew up!'
To give me a quick way to run commands and hopefully enough words to catch my attention.
Re:My Favorite One Liners by the_pwner224 on Monday May 03, 2021 @01:59PM (#27028451)
As an audio-free alternative to `say 'success'`, you could use `tput bel`. Konsole, and many other terminals, can flash the screen or show a normal OS notification when a terminal bell is triggered in a non-active terminal window. This doesn't do the success/fail thing though.
Re:My Favorite One Liners by renox on Tuesday May 04, 2021 @02:13PM (#27040714)
I do something similar for long job on the remote server: an alias to send me an email + a rule in Outlook which opens a popup when an email with this subject is received (I haven't managed to get sound from VNC)