Re: $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]

 



Test $?, or key in a command name you know isn't on your system and after command not found returns type echo $? then hit enter. You'll get the error code back that way.

On Fri, 22 Apr 2016, Lars Bj?rndal wrote:

Date: Fri, 22 Apr 2016 17:09:23
From: Lars Bj?rndal <lars@xxxxxxxxxxx>
Reply-To: Linux for blind general discussion <blinux-list@xxxxxxxxxx>
To: Linux for blind general discussion <blinux-list@xxxxxxxxxx>
Subject: $PROMPT_COMMAND (WAS: Re: Using $PROMPT_COMMAND to beep depending on
    success/failure)

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


--

_______________________________________________
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]