Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
add current svn branch to shell prompt
function parse_svn_branch {
if [ -d '.svn' ]; then
ref=$(svn info | grep URL | awk -F/ '{print $NF}' 2> /dev/null) || return
cur=$(pwd | awk -F/ '{print $NF}' 2> /dev/null) || return
if [ $ref != $cur ]; then
echo "#$ref"
fi
fi
}
export PS1="\u@\h:\w\[\e[31;40m\]\$(parse_svn_branch)\[\e[0m\] \$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment