Re: Using $PROMPT_COMMAND to beep depending on success/failure

Jude DaShiell <[email protected]>
Newsgroups gmane.linux.redhat.blinux.general
Message-ID <[email protected]>
Tim, thanks.  I have an application in mind for this.
What I've been doing so far to test network connected status was:
ping -c 5 www.google.com|grep %
That returns a line of output giving packet thruput statistics and if I 
have 0 percent packet loss I know my network is up.  I just need to 
figure out how to itegrate this.

On Wed, 20 Apr 2016, Tim Chase wrote:

> Date: Wed, 20 Apr 2016 14:41:11
> From: Tim Chase <[email protected]>
> Reply-To: Linux for blind general discussion <[email protected]>
> To: Linux for blind general discussion <[email protected]>
> Subject: Using $PROMPT_COMMAND to beep depending on success/failure
> 
> Stumbled on this one today thanks to @climagic on Twitter.  If you
> want to have your machine give you one tone if the previous command
> succeeded (had an exit-status of 0) and a different tone if the
> previous command failed (had a non-zero exit status), you can put the
> following one-liner in your .bashrc file:
>
> PROMPT_COMMAND='[ "$?" == 0 ] && play -qn synth sin F3 trim 0 0 0.1
> fade 0 0.1 0.05 vol 0.2 || play -qn synth square F4 trim 0 0.1 fade 0
> 0.1 0.05'
>
> This uses the `play` command from the `sox` package.  There are a
> number of tweaks you can make to change the tones, timbres,
> wave-form, volume, duration, etc.  The above uses an F3 sine-wave at
> 20% volume for success and an F4 square-wave at 100% volume for
> failure.
>
> To test it out, use the `true` and `false` commands (they don't do
> anything other than exit with a particular zero/non-zero exit code).
>
> But here's hoping someone here finds it useful.
>
> -tim
>
>
>
> _______________________________________________
> Blinux-list mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/blinux-list
>

--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.