参考http://blog.csdn.net/redraiment/article/details/4535630
但是原命令在mac下不行.其实是转义符不一样.改一下就好了.
现在我的:
export PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]O_O\[\e[0m\]; fi\`\[\e[32[\t]\W$ "
效果:
^_^[22:44:28]remoteGit$ commmm
-bash: commmm: command not found
O_O[22:45:10]remoteGit$