Created
February 9, 2020 07:09
-
-
Save Hashbrown777/6960469f388ac4fdce54e0b26de44aba to your computer and use it in GitHub Desktop.
neat coloured prompt for bash that shows `user@pcname:pwd\n$?>` where $? changes between red and green if it was an error or no
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prompt-color() { printf '\\[\e[38;5;%sm\\]%s\\[\e[m\\]' "$1" "$2"; } | |
PS1="$(printf '%s' \ | |
'\n' \ | |
`prompt-color 226 '\u'` \ | |
'@' \ | |
`prompt-color 208 '\h'` \ | |
':' \ | |
`prompt-color 207 '\w'` \ | |
'\n' \ | |
`prompt-color '$(( $?==0 ? 82 : 196 ))' '$?'` \ | |
`prompt-color 240 '> '` \ | |
)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment