[LRUG] Last exit status in bash prompt
Andrew Stewart
boss at airbladesoftware.com
Tue Jan 10 04:22:26 PST 2012
On 9 Jan 2012, at 15:20, Andrew Stewart wrote:
> I'm having trouble incorporating the exit status of the last command into my bash prompt. My prompt executes a couple of commands to display the current Ruby version and the current git status, and then I want to use the exit status of the last command to control the colour of the final character (e.g. $).
Thanks everyone for your help and suggestions. It was interesting looking at the different solutions. In the end I went with Viktor's method of setting up PS1 in PROMPT_COMMAND.
https://github.com/airblade/dotfiles/blob/master/bash/prompt
As for switching to zsh, I've intended to ever since reading "From Bash to Z Shell" by Kiddle, Peek, and Stephenson about three years ago! One day I'll switch.
Thanks again,
Andy
-------
http://airbladesoftware.com
More information about the Chat
mailing list