You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
# ~/.bashrc: executed by bash(1) for non-login shells.
# If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac
# don't put duplicate lines or lines starting with space in the history. HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000
# check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color|*-256color) color_prompt=yes export COLOR_OPTIONS='--color=auto' ;; esac
# enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). if ! shopt -oq posix; then if [ -f /usr/share/bash-completion/bash_completion ]; then . /usr/share/bash-completion/bash_completion elif [ -f /etc/bash_completion ]; then . /etc/bash_completion fi fi
__prompt_command() { local EXIT="$?" # This needs to be first
local R='\[\e[0m\]' local Red='\[\e[1;31m\]' local Gre='\[\e[1;32m\]' local Yel='\[\e[1;33m\]' local Ora='\[\e[0;33m\]' local Blu='\[\e[1;34m\]' local Cya='\[\e[1;36m\]' local Mag='\[\e[1;95m\]' local Gra='\[\e[1;30m\]'
PS1=''
if [[ $container == 'lxc' ]];then PS1+="${Gra}[LXC:${R}" local host=$container_hostname case ${host:0:4} in 'beta') PS1+="${Yel}";; 'prod') PS1+="${Red}";; *) esac PS1+="${host}${Gra}] " fi if [ `id -u` -eq 0 ]; then PS1+="${Yel}\u${R}" PROMPT='$' else PS1+="$Gre\u$R" PROMPT='#' fi
PS1+="${Gra}@"
case ${HOSTNAME:0:4} in 'beta') PS1+="${Yel}";; 'prod') PS1+="${Red}";; *) PS1+="${R}";; esac PS1+="\h" PS1+=" ${Cya}\w${R}"
if hash git 2>&-; then # git command exists
if git rev-parse --git-dir > /dev/null 2>&1; then # current dir is version controlled local branch=$(git branch 2> /dev/null | grep -e ^* | cut -d ' ' -f2) PS1+=" ${R}[${Mag}${branch}${R}|"
local dirty=$(git status -s | wc -l) if [[ $dirty -ne 0 ]]; then PS1+="${Mag}…$dirty" else local ahead=$(git rev-list --branches --not --remotes |wc -l) if [[ $ahead -ne 0 ]]; then PS1+="${Blu}↑${ahead}" else tag_release=`git describe --exact-match --tags $(git log -n1 --pretty='%h') 2> /dev/null` if [[ -z $tag_release ]];then PS1+="${Red}✔" else PS1+="${Gre}✔${R}|${Blu}${tag_release}" fi fi fi PS1+="${R}]" fi fi
if [ $EXIT != 0 ]; then PS1+="$Mag" # Add red if exit code non 0 else PS1+="$Gra" fi
PS1+=" $PROMPT ${R}" }
PROMPT_COMMAND='__prompt_command' # Func to gen PS1 after CMDs
DEBIAN_BASH_DIR=/opt/debian-bash
# You may uncomment the following lines if you want `ls' to be colorized:
alias ls='ls $COLOR_OPTIONS' alias ll='ls $COLOR_OPTIONS -l' alias lh='ls $COLOR_OPTIONS -lh' alias la='ls $COLOR_OPTIONS -lA' alias ltr='ls $COLOR_OPTIONS -ltrh' alias l=ls
alias cd..='cd ..' alias ..=cd..
alias grep='grep $COLOR_OPTIONS' alias fgrep='fgrep $COLOR_OPTIONS' alias egrep='egrep -$COLOR_OPTIONS'
# Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi
#PATH=$HOME/.bin:$HOME/DEV/debian-server:$PATH
|