-
-
Save philip-bl/2e0e98ef9e80364cb9812ab522e5d938 to your computer and use it in GitHub Desktop.
Custom bash prompt
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
# becomes red if previous command's result is not zero | |
# records time | |
# looks kinda nice | |
function red_if_nonzero { | |
RETVAL=$?; # get status code of the previously run command | |
[ $RETVAL -ne 0 ] && tput setaf 1; # if it's not 0, use color red | |
return 0; | |
} | |
PS1='\[`red_if_nonzero`\]\[`tput bold`\][\A \u \w]\$ \[`tput sgr0`\]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment