Re: sounds on wsl commendline

Tage Johansson
 

Hello,

I'm glad that you are trying out a unix shell. I've used a linux command line for three years now and I can say that it is very fun. I use less and less graphical programs and use the command line for more and more. Today I only use a mail program (Thunderbird) and a web browser (Firefox) outside the terminal. Command line applications are much more understandable, accessible and customizable than graphical programs. It takes some more time to learn it, but you learn what you are really doing rather than how to use a complicated gui. WSL is also really awsum.


Anyway, on to your question. You want to know if the last commandsucceeded or not, quicly. In unix, the exit status of a command is denoted by a return code. If the return code is 0 the command was successful otherwise it failed. The simplest solution is to customize your prompt string so that it contains the return code of the last command.


I don't know what shell you are using. Most probably you are using bash but you can check that by issuing the command `echo $shell`. If the output is something similar to /bin/bash or /usr/bin/bash, you are good to go.


Now you should edit your .bashrc file located right under your home directory. Paste the following text at the bottom of the file:


__old_ps1=$PS1
__prompt_command() {
    PS1="($?)$__old_ps1"
}
PROMPT_COMMAND=__prompt_command


Save the file and restart your shell. The prompt should now contain the return code in parenthesis at the start of the line.


Feel free to experiment with that code and if you have any questions feel free to ask.


Best regards,

Tage


On 6/22/2020 8:25 PM, UMIT ERDEM Yigitoglu wrote:
Hello, 
I have just started to learn about unix commendline with windows subsystem for linux. I use commendline with a braille display and want to sielence nvda. However, I want to be able to know if my commend executed correctly without using review currcer all the time. I was wanderring if there is a tool that will have different tones for different kinds of output and different kinds of error messages? if such programm is possible and it is yet to be done I would love to work on it later when ı advance in programming, I believe it will be very important tool for blind programmers. any ideas?  

Join nvda-devel@groups.io to automatically receive all group messages.