function is_git_repo() { if [ -d .git ]; then return 0; fi return 1; } function get_git_branch() { if is_git_repo ; then printf "($(git status 2> /dev/null | awk '/branch /{print $3; exit;}'))" fi } function get_git_up2date() { if is_git_repo ; then if [ $(git status 2>/dev/null | awk '/nothing to commit, working tree clean/{print $1}') ]; then printf ${grn_fn}; else printf ${red_fn}; fi fi } PS1=${ylw}'\u:'${blu}'\W '${wht}'$(get_git_branch)\[$(get_git_up2date)\]\$ '${clr}