Ok, now this one is actually something I came out with myself. Each time I type a wrong command,
it plays a sound.
We make use of a fact that
$? holds return value of last used command and when we type command that doesn't exist it returns
Let's start by writing little command. In our
.bashrc we add somewhere at the begin
if [ $ret == 127 ]
(mpv /home/satan/data/dźwięki/kamimashita.wav --volume=120 --loop-file=no --no-terminal &) 2> /dev/null
I use mpv for this, but any player should do. Remember to replace my file path with proper one.
Now, we also need to know about one more interesting system variable.
PROMPT_COMMAND can contain a command that will be run each time before prompt is shown. Let's run our command there.
And done. Now each time we type wrong command, a sound is gonna play.
We can edit it a little, so it plays each time a command fails, just replace
if [ $ret == 127 ] with
if [ $ret != 0 ] && [ $ret != 130 ]
0 is value returned when command is executed properly.
130 is exception I added for one command that kept returning it even if everything was ok. Don't remember which one was it though.
edit: replaced opus file with wav as it runs faster (no lag between typing wrong command and playing a sound)