Skip to content

Instantly share code, notes, and snippets.

@hellojinjie
Last active December 19, 2015 00:18
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 hellojinjie/5867255 to your computer and use it in GitHub Desktop.
Save hellojinjie/5867255 to your computer and use it in GitHub Desktop.
酷酷的 PS1 : )
// 第一个是原文的,但是不对的,下面的第二个是我修改的。
// original from http://jamiedubs.com/ps1-collection-customize-your-bash-prompt
// export PS1="\[\e[01;32m\]\u@\h \[\e[01;34m\]\W \`if [ \$? = 0 ]; then echo -e '\e[01;32m:)'; else echo -e '\e[01;31m:('; fi\` \[\e[01;34m\]$\[\e[00m\] "
export PS1="\[\e[01;32m\]\u@\h \[\e[01;34m\]\W \`if [ \$? = 0 ]; then echo -e '\[\e[01;32m\]:)'; else echo -e '\[\e[01;31m\]:('; fi\` \[\e[01;34m\]$\[\e[00m\] "

当前一次命令执行成功的时候,PS1 为绿色的笑脸符号。 如果是失败,则是红色的 :)

效果图

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment