Skip to content

Instantly share code, notes, and snippets.

@refactor
Created August 18, 2023 09:59
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 refactor/8a1aaef9769845e6d74953acae619cd2 to your computer and use it in GitHub Desktop.
Save refactor/8a1aaef9769845e6d74953acae619cd2 to your computer and use it in GitHub Desktop.
bash error prompt
PS1="\$(\
EXIT=\"\$?\" ; \
RED=\"\[\e[31m\]\" ; \
WHITE=\"\[\e[0m\]\" ; "
PS1+="\
endchar=\"\\$\${WHITE}\" ; \
if [ \"\$EXIT\" -eq 0 ]; then \
endchar=\"\${WHITE}\$endchar\" ; \
else \
endchar=\"\${RED}[\$(errno \${EXIT})] \$endchar\";\
fi ; "
PS1+="echo \"${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$endchar \" )"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment