.bash_profile备份

# ~/.bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

none="33[0m"
black="33[0;30m"
dark_gray="33[1;30m"
blue="33[0;34m"
light_blue="33[1;34m"
green="33[0;32m"
light_green="33[1;32m"
cyan="33[0;36m"
light_cyan="33[1;36m"
red="33[0;31m"
light_red="33[1;31m"
purple="33[0;35m"
light_purple="33[1;35m"
brown="33[0;33m"
yellow="33[1;33m"
light_gray="33[0;37m"
white="33[1;37m"

find_git_branch () {
    local dir=. head
    until [ "$dir" -ef / ]; do
        if [ -f "$dir/.git/HEAD" ]; then
            head=$(< "$dir/.git/HEAD")
            if [[ $head = ref: refs/heads/* ]]; then
                git_branch="[${head#*/*/}]"
            elif [[ $head != '' ]]; then
                git_branch="(detached)"
            else
                git_branch="(unknow)"
            fi  
            return
        fi  
        dir="../$dir"
    done
    git_branch=''
}

PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND"
PS1="$cyanu$none@$cyanh$none:$greenw$brown$git_branch$none$ "

PATH=$PATH:$HOME/bin

export PATH
原文地址:https://www.cnblogs.com/arliang/p/3183560.html