1
eth2net 2010-10-04 17:58:20 +08:00
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
哇,前两天的问题终于解决了。 |
2
kidblg 2010-10-04 21:31:53 +08:00
准备转git
|
4
harryxu 2010-10-05 02:01:06 +08:00
|
5
raecoo 2010-10-05 17:30:51 +08:00
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) 三段分别用不同的颜色显示 |