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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 20, 2016 at 01:41:11PM -0500, Tim Chase wrote:
> 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'

Do any of you know of a way to get a number as the first cell(s)
in the prompt indicating the error code of the previous command? E.g.

1[user@host ~]#

if something gets wrong? If zero, I'd like to get no number output.
I think that could be convenient when using braille.

Thanks and regards, Lars

_______________________________________________
Blinux-list mailing list
Blinux-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/blinux-list



[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]