Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # .bashrc
- # User specific aliases and functions
- alias rm='rm -i'
- alias cp='cp -i'
- alias mv='mv -i'
- alias ll='ls -al'
- # Source global definitions
- if [ -f /etc/bashrc ]; then
- . /etc/bashrc
- fi
- # User specific aliases and functions
- 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"
- # Here is bash color codes you can use
- black=$'\[\e[1;30m\]'
- red=$'\[\e[1;31m\]'
- green=$'\[\e[1;32m\]'
- yellow=$'\[\e[1;33m\]'
- blue=$'\[\e[1;34m\]'
- magenta=$'\[\e[1;35m\]'
- cyan=$'\[\e[1;36m\]'
- white=$'\[\e[1;37m\]'
- normal=$'\[\e[m\]'
- ip=`/sbin/ifconfig br0 | awk -F '[ :]+' '/inet /{print $3}' | head -n1`
- PS1="$white[$green\u$white@$red$ip$white:$cyan\W$yellow\$git_branch$white]# $normal"
Add Comment
Please, Sign In to add comment