HalloweenBash
HalloweenBash copied to clipboard
Last command exit status
In my PS1, I find it useful to see the exit status of the last entered command. In order to do this, I need to define a function that dynamically changes PS1 using PROMPT_COMMAND
function exitstatus {
if [ $? -eq 0 ]
then
export PS1="✓ $PROMPT"
else
export PS1="× $PROMPT"
fi
}
PROMPT_COMMAND='exitstatus'
Does this seem like something worth adding to Halloween, or is the ceremony involved too much?
Hi @duncanbeevers
I'm on the fence, but I understand that it can be easier to read.
What would you name the label? Right now, there is a label for 'exit status', so I'd like to name your Checkmark & X something distinct.
Thanks, -Rex
Well, I'm pretty terrible at naming things. How do these sound?
- success indicator
- things ok?
- good new/bad news
- checkex
- happiness
Those are on the right track, but how about something closer to 'exit status with icon'?
Feel free to submit a pull request that I'll review. Thanks