emkay443

.bashrc

Aug 25th, 2013
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.61 KB | None | 0 0
  1. # System-wide .bashrc file for interactive bash(1) shells.
  2.  
  3. # To enable the settings / commands in this file for login shells as well,
  4. # this file has to be sourced in /etc/profile.
  5.  
  6. # If not running interactively, don't do anything
  7. [ -z "$PS1" ] && return
  8.  
  9. # check the window size after each command and, if necessary,
  10. # update the values of LINES and COLUMNS.
  11. shopt -s checkwinsize
  12.  
  13. # set variable identifying the chroot you work in (used in the prompt below)
  14. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  15.     debian_chroot=$(cat /etc/debian_chroot)
  16. fi
  17.  
  18. use_color=false
  19.  
  20. # Set colorful PS1 only on colorful terminals.
  21. # dircolors --print-database uses its own built-in database
  22. # instead of using /etc/DIR_COLORS.  Try to use the external file
  23. # first to take advantage of user additions.  Use internal bash
  24. # globbing instead of external grep binary.
  25. safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM
  26. match_lhs=""
  27. [[ -f ~/.dir_colors   ]] && match_lhs="${match_lhs}$(<~/.dir_colors)"
  28. [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(</etc/DIR_COLORS)"
  29. [[ -z ${match_lhs}    ]] \
  30.         && type -P dircolors >/dev/null \
  31.         && match_lhs=$(dircolors --print-database)
  32. [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true
  33.  
  34. if ${use_color} ; then
  35.         # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
  36.         if type -P dircolors >/dev/null ; then
  37.                 if [[ -f ~/.dir_colors ]] ; then
  38.                         eval $(dircolors -b ~/.dir_colors)
  39.                 elif [[ -f /etc/DIR_COLORS ]] ; then
  40.                         eval $(dircolors -b /etc/DIR_COLORS)
  41.                 fi
  42.         fi
  43.  
  44.         if [[ ${EUID} == 0 ]] ; then
  45.                 #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
  46.         PS1="\[$(tput setaf 6)\]\w \[$(tput bold)\]\[$(tput setaf 1)\]>>> \[$(tput setaf 7)\]\[$(tput sgr0)\]"
  47.         else
  48.                 #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
  49.         PS1="\[$(tput setaf 6)\]\w \[$(tput bold)\]\[$(tput setaf 1)\]>\[$(tput setaf 3)\]>\[$(tput setaf 2)\]> \[$(tput setaf 7)\]\[$(tput sgr0)\]"
  50.         fi
  51.  
  52.         alias ls='ls --color=auto'
  53.         alias grep='grep --colour=auto'
  54. else
  55.         if [[ ${EUID} == 0 ]] ; then
  56.                 # show root@ when we don't have colors
  57.                 PS1='\u@\h \W \$ '
  58.         else
  59.                 PS1='\u@\h \w \$ '
  60.         fi
  61. fi
  62.  
  63. # Try to keep environment pollution down, EPA loves us.
  64. unset use_color safe_term match_lhs
  65.  
  66. # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
  67. # If this is an xterm set the title to user@host:dir
  68. #case "$TERM" in
  69. #xterm*|rxvt*)
  70. #    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
  71. #    ;;
  72. #*)
  73. #    ;;
  74. #esac
  75.  
  76. # enable bash completion in interactive shells
  77. if [ -f /etc/bash_completion ]; then
  78.     . /etc/bash_completion
  79. fi
  80.  
  81. # if the command-not-found package is installed, use it
  82. if [ -x /usr/lib/command-not-found ]; then
  83.     function command_not_found_handle {
  84.             # check because c-n-f could've been removed in the meantime
  85.                 if [ -x /usr/lib/command-not-found ]; then
  86.            /usr/bin/python /usr/lib/command-not-found -- $1
  87.                    return $?
  88.         else
  89.            return 127
  90.         fi
  91.     }
  92. fi
  93.  
  94. # put /usr/sbin in $PATH if it isn't there yet
  95. if [ -d /usr/sbin ]; then
  96.     if [ -z "$(echo $PATH | grep /usr/sbin)" ]; then
  97.         PATH=$PATH":/usr/sbin"
  98.     fi
  99. fi
  100.  
  101. # determine installed package managers and use what's available
  102. distro="debianoid"
  103. if [ "$(which apt-fast 2> /dev/null)" ]; then
  104.     pkg_manager="apt-fast"
  105. elif [ "$(which apt-get 2> /dev/null)" ]; then
  106.     pkg_manager="apt-get"
  107. elif [ "$(which aptitude 2> /dev/null)" ]; then
  108.     pkg_manager="aptitude"
  109. elif [ "$(which yaourt 2> /dev/null)" ]; then
  110.     pkg_manager="yaourt"
  111.     distro="archoid"
  112. else
  113.     pkg_manager=""
  114.     skip_apt_aliases=true
  115. fi
  116.  
  117. if [ ! $skip_apt_aliases ]; then
  118.     if [[ $distro == debianoid ]]; then
  119.         alias install="sudo $pkg_manager install"
  120.         alias update="sudo $pkg_manager update"
  121.         alias upgrade="sudo $pkg_manager upgrade"
  122.         alias dist-upgrade="sudo $pkg_manager dist-upgrade"
  123.         alias remove="sudo $pkg_manager remove"
  124.         alias autoremove="sudo $pkg_manager autoremove"
  125.     elif [[ $distro == archoid ]]; then
  126.         alias install="sudo $pkg_manager -S"
  127.         alias update="sudo $pkg_manager -Sy"
  128.         alias upgrade="sudo $pkg_manager -Syu"
  129.         alias dist-upgrade="sudo $pkg_manager -Syu"
  130.         alias remove="sudo $pkg_manager -R"
  131.     fi
  132. fi
  133.  
  134. if [ "$(which add-apt-repository 2> /dev/null)" ]; then
  135.     alias addrepo="sudo add-apt-repository"
  136. fi
Advertisement
Add Comment
Please, Sign In to add comment