Created
September 12, 2015 19:14
-
-
Save gaieges/0ecfcbe03af7cbb7de92 to your computer and use it in GitHub Desktop.
great PS1 var with return value coloring
This file contains 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_COMMAND='PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u@\h:\`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"' | |
PS1='\[\033[0;33m\][\!]`if [[ $? = 0 ]]; then echo \[\033[32m\]; else echo \[\033[31m\]; fi`[\u@\h:`if [[ 30 > 18 ]]; then echo \W; else echo \w; fi`]$\[\033[0m\] ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment