get_git_branch(){
local branch__=
git branch &> /dev/null
if [ $? -eq 0 ]; then
branch__=`git branch --no-color | sed -ne 's/^\* \(.*\)$/\1/1p' | tr a-z A-Z`
else
branch__="NORMAL"
fi
echo -n $branch__
}
exit_status(){
local smile__=
if [ $? -eq 0 ]; then
smile__='(*´▽`*)'
else
smile__='(╥﹏╥)'
fi
echo -n $smile__
}
export PS1='[\w]\d\t\$\n\u->(`get_git_branch`)`exit_status`:'
这是我的 bashrc 中的 PS1 设置,我想在我的终端中检查 git 分支和退出状态,每次刷新 PS1 时 get_git_branch 都有效,但 exit_status 没有,乳清 exit_status 没有执行?