Skip to content

Instantly share code, notes, and snippets.

@meoso
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meoso/ca3838d0d84b4215ccf8 to your computer and use it in GitHub Desktop.
Save meoso/ca3838d0d84b4215ccf8 to your computer and use it in GitHub Desktop.
basic errorcode enabled bash prompt
#for ~/.bashrc
DULL=0
FG_RED=31
FG_GREEN=32
ESC="\033"
NORMAL="\[$ESC[m\]"
RED="\[$ESC[${DULL};${FG_RED}m\]"
GREEN="\[$ESC[${DULL};${FG_GREEN}m\]"
PS1="$NORMAL \$(if [[ \$? == 0 ]]; then echo \"$GREEN\342\234\223\"; else echo \"$RED\342\234\227\"=\$?; fi) $NORMAL\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w \$ "
@meoso
Copy link
Author

meoso commented Jan 27, 2015

looks like: (but with green ✓ and red ✗=)

 ✓ user@host:~ $ true
 ✓ user@host:~ $ false
 ✗=1 user@host:~ $ 
 ✗=1 user@host:~ $ true
 ✓ user@host:~ $ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment