dev/provisioning/files/.bashrc
changeset 28 b0b56e0f8c7f
parent 27 a2342f26c9de
child 29 50702e620af4
equal deleted inserted replaced
27:a2342f26c9de 28:b0b56e0f8c7f
     1 # ~/.bashrc: executed by bash(1) for non-login shells.
       
     2 # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
       
     3 # for examples
       
     4 
       
     5 # Source global definitions
       
     6 if [ -f /etc/bashrc ]; then
       
     7         . /etc/bashrc
       
     8 fi
       
     9 
       
    10 # If not running interactively, don't do anything
       
    11 # [ -z "$PS1" ] && return
       
    12 case $- in
       
    13     *i*) ;;
       
    14       *) return;;
       
    15 esac
       
    16 
       
    17 # don't put duplicate lines or lines starting with space in the history.
       
    18 # See bash(1) for more options
       
    19 HISTCONTROL=ignoreboth
       
    20 
       
    21 # append to the history file, don't overwrite it
       
    22 shopt -s histappend
       
    23 
       
    24 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
       
    25 HISTSIZE=10000
       
    26 HISTFILESIZE=100000000
       
    27 
       
    28 # avoid losing history
       
    29 PROMPT_COMMAND="history -a"
       
    30 export HISTSIZE PROMPT_COMMAND
       
    31 
       
    32 TERM=xterm-256color
       
    33 
       
    34 # check the window size after each command and, if necessary,
       
    35 # update the values of LINES and COLUMNS.
       
    36 shopt -s checkwinsize
       
    37 
       
    38 # If set, the pattern "**" used in a pathname expansion context will
       
    39 # match all files and zero or more directories and subdirectories.
       
    40 #shopt -s globstar
       
    41 
       
    42 # make less more friendly for non-text input files, see lesspipe(1)
       
    43 [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
       
    44 
       
    45 # set a fancy prompt (non-color, unless we know we "want" color)
       
    46 case "$TERM" in
       
    47     xterm-256color) color_prompt=yes;;
       
    48 esac
       
    49 
       
    50 # uncomment for a colored prompt, if the terminal has the capability; turned
       
    51 # off by default to not distract the user: the focus in a terminal window
       
    52 # should be on the output of commands, not on the prompt
       
    53 # force_color_prompt=yes
       
    54 
       
    55 if [ -n "$force_color_prompt" ]; then
       
    56     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
       
    57 	# We have color support; assume it's compliant with Ecma-48
       
    58 	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
       
    59 	# a case would tend to support setf rather than setaf.)
       
    60 	color_prompt=yes
       
    61     else
       
    62 	color_prompt=
       
    63     fi
       
    64 fi
       
    65 
       
    66 if [ "$color_prompt" = yes ]; then
       
    67     # PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
       
    68     PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
       
    69 else
       
    70     # PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
       
    71     PS1='\u@\h:\w\$ '
       
    72 fi
       
    73 unset color_prompt force_color_prompt
       
    74 
       
    75 # If this is an xterm set the title to user@host:dir
       
    76 case "$TERM" in
       
    77 xterm*|rxvt*)
       
    78     # Do it ONLY when connecting via pts BUT NOT tty
       
    79     # pts - ssh or terminal emulators like konsole or gnome-terminal
       
    80     # otherwise it'll mess up the Bash prompt PS1
       
    81     mytty=$(tty)
       
    82     if [[ ${mytty:5:3} = "pts" ]]; then
       
    83         PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
       
    84         # PS1="\[\e]0;\u@\h: \w\a\]$PS1"
       
    85     fi
       
    86     ;;
       
    87 *)
       
    88     ;;
       
    89 esac
       
    90 
       
    91 # enable color support of ls and also add handy aliases
       
    92 if [ -x /usr/bin/dircolors ]; then
       
    93     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
       
    94     alias ls='ls --color=auto'
       
    95     #alias dir='dir --color=auto'
       
    96     #alias vdir='vdir --color=auto'
       
    97 
       
    98     alias grep='grep --color=auto'
       
    99     alias fgrep='fgrep --color=auto'
       
   100     alias egrep='egrep --color=auto'
       
   101 fi
       
   102 
       
   103 # color for man pages
       
   104 man() {
       
   105     env LESS_TERMCAP_mb=$(printf "\e[1;31m") \
       
   106         LESS_TERMCAP_md=$(printf "\e[1;31m") \
       
   107         LESS_TERMCAP_me=$(printf "\e[0m") \
       
   108         LESS_TERMCAP_se=$(printf "\e[0m") \
       
   109         LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
       
   110         LESS_TERMCAP_ue=$(printf "\e[0m") \
       
   111         LESS_TERMCAP_us=$(printf "\e[1;32m") \
       
   112         man "$@"
       
   113 }
       
   114 
       
   115 # some more ls aliases
       
   116 alias ll='ls -alF'
       
   117 alias la='ls -A'
       
   118 alias l='ls -CF'
       
   119 
       
   120 # Add an "alert" alias for long running commands.
       
   121 # Use like so: sleep 10; alert
       
   122 alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
       
   123 
       
   124 # Alias definitions.
       
   125 # You may want to put all your additions into a separate file like
       
   126 # ~/.bash_aliases, instead of adding them here directly.
       
   127 # See /usr/share/doc/bash-doc/examples in the bash-doc package.
       
   128 
       
   129 if [ -f ~/.bash_aliases ]; then
       
   130     . ~/.bash_aliases
       
   131 fi
       
   132 
       
   133 # enable programmable completion features (you don't need to enable
       
   134 # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
       
   135 # sources /etc/bash.bashrc).
       
   136 # if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
       
   137 #     . /etc/bash_completion
       
   138 # fi
       
   139 
       
   140 if ! shopt -oq posix; then
       
   141     if [ -f /usr/share/bash-completion/bash_completion ]; then
       
   142         . /usr/share/bash-completion/bash_completion
       
   143     elif [ -f /etc/bash_completion ]; then
       
   144         . /etc/bash_completion
       
   145     fi
       
   146 fi
       
   147 
       
   148 
       
   149 #activate remi php56 scl
       
   150 source /opt/remi/php56/enable