1
eth2net 2010 年 10 月 4 日
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
哇,前两天的问题终于解决了。 |
2
kidblg 2010 年 10 月 4 日
准备转git
|
4
harryxu 2010 年 10 月 5 日
|
5
raecoo 2010 年 10 月 5 日
parse_git_branch() {
RSLT='' GIT_BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/^* //'` if [ "$GIT_BRANCH" ] then GIT_STATUS=`git status 2> /dev/null | grep 'working directory clean'` CLR='2' if [ "$GIT_STATUS" ] then CLR='2' else CLR='1' fi RSLT="[3${CLR};40m(${GIT_BRANCH})[0m" fi echo $RSLT } parse_git_remote_status() { RSLT='' GIT_REMOTE_STATUS=`git status 2>/dev/null | grep 'Your branch is ahead of'` if [ "$GIT_REMOTE_STATUS" ] then RSLT="[31;40mr[0m" fi echo $RSLT } COL=`expr $COLUMNS - 1` LINE='' COUNT=0 while test ${COL} -gt $COUNT do let COUNT++ LINE="${LINE}-" done export PS1='[0;36m[${COL}D[0;33m[\u:[0;35m\W[0;33m][0;36m$(parse_git_branch)[0;32m \$ ' [raecoo:edm](master) 三段分别用不同的颜色显示 |