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