xta / HalloweenBash

Custom Bash Profile Generator
http://xta.github.io/HalloweenBash/
333 stars 32 forks source link

Last command exit status #9

Open duncanbeevers opened 11 years ago

duncanbeevers commented 11 years ago

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?

xta commented 11 years ago

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

duncanbeevers commented 11 years ago

Well, I'm pretty terrible at naming things. How do these sound?

xta commented 11 years ago

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