HalloweenBash icon indicating copy to clipboard operation
HalloweenBash copied to clipboard

Last command exit status

Open duncanbeevers opened this issue 12 years ago • 3 comments

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?

duncanbeevers avatar Aug 12 '13 23:08 duncanbeevers

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

xta avatar Aug 13 '13 05:08 xta

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

  • success indicator
  • things ok?
  • good new/bad news
  • checkex
  • happiness

duncanbeevers avatar Aug 13 '13 06:08 duncanbeevers

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

xta avatar Aug 14 '13 01:08 xta