I experience this strange problem when my completion status always returns 0, even when it did not succeed.
I want to display the completion status in my invitation with the following code:
function status() { echo $? } export PS1="\$(status)>"
When I run this, I get the following output
0❯ pwd /Users/tringuyen 0❯ ad bash: ad: command not found 0❯ echo $? 127
it is clear that the second last ad command did not return the status code 0. However, this is what I got from the prompt.
Does anyone know what can happen here?
EDIT 6/20 11:57 AM: The problem is that $? always 0 regardless of the fact that an error occurred in the .bashrc file itself that will force it to return a value other than 0 .
source share