#!/bin/sh BRANCH=$(git branch --show-current 2>/dev/null) BRANCH=$(test -d .git && test -n $BRANCH && echo "($BRANCH)") PROMPT="$USER@$(hostname):$( test $PWD = $HOME && echo '~' || basename "$PWD")$BRANCH" case $(id -u) in 0) echo "$PROMPT# " ;; *) echo "$PROMPT$ " ;; esac