Advertisement
noes1s

Intall .bashrc - Ubuntu 12.04

Nov 4th, 2012
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.35 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. ! ((UID)) && echo -e "\n\e[1;31m"' (!) '"Dont use 'sudo'\e[m\n" && exit 1
  4.  
  5. echo -e "\e[33m Creating backup...\e[m"
  6. mv ~/.bashrc ~/.bashrc.bak 2>/dev/null
  7. sudo mv /root/.bashrc /root/.bashrc.bak 2>/dev/null
  8.  
  9. sleep 0.5 && echo -e "\e[33m Creating new bashrc...\e[m"
  10. echo '#  ,___    
  11. #  ¡  _`    
  12. #  ª_/()    .bashrc
  13. #  |\` `,   http://pastebin.com/u/noes1s
  14. # _·    l  
  15.  
  16. ### If not running interactively, stop
  17.    [[ -z "$PS1" ]] && return
  18.    
  19. ### Extract file, example. "ex package.tar.bz2"
  20. ex() {
  21.    if [[ -f $1 ]]; then
  22.        case $1 in
  23.            *.tar.bz2)   tar xjf $1  ;;
  24.            *.tar.gz)    tar xzf $1  ;;
  25.            *.bz2)       bunzip2 $1  ;;
  26.            *.rar)       rar x $1    ;;
  27.            *.gz)        gunzip $1   ;;
  28.            *.tar)       tar xf $1   ;;
  29.            *.tbz2)      tar xjf $1  ;;
  30.            *.tgz)       tar xzf $1  ;;
  31.            *.zip)       unzip $1    ;;
  32.            *.Z)         uncompress $1  ;;
  33.            *.7z)        7z x $1     ;;
  34.            *)           echo $1 cannot be extracted ;;
  35.        esac
  36.    else
  37.        echo $1 is not a valid file
  38.    fi
  39. }
  40.  
  41. ### Directory navigation aliases
  42. alias ..="cd .."
  43. alias ...="cd ../.."
  44. alias ....="cd ../../.."
  45. alias .....="cd ../../../.."
  46.  
  47. ### Don not put duplicate lines in the history
  48.    HISTCONTROL=ignoredups:ignorespace
  49.    
  50. ### Resize terminal if necesary
  51.    shopt -s checkwinsize
  52.  
  53. ### Add more colors
  54.    [[ -x /usr/bin/dircolors ]] && {
  55.    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  56.    alias ls="ls --color=auto"
  57.    alias dir="dir --color=auto"
  58.    alias vdir="vdir --color=auto"
  59.    alias grep="grep --color=auto"
  60.    alias fgrep="fgrep --color=auto"
  61.    alias egrep="egrep --color=auto"
  62.    }
  63.    
  64. ### Add more aliases
  65.    alias ll="ls -alF"
  66.    alias la="ls -A"
  67.    alias l="ls -CF"
  68.    
  69.    alias upd="sudo apt-get update"
  70.    alias upg="sudo apt-get upgrade"
  71.    alias ins="sudo apt-get install"
  72.    alias rem="sudo apt-get purge"
  73.    alias fix="sudo apt-get install -f"
  74.  
  75. ### Prompt    
  76. ((UID)) &&
  77. PS1="\[\e[1;32m\]\u\[\e[0;34m\]@\h\[\e[0;37m\]\w\[\e[1;32m\]\\$\[\e[m\] " ||
  78. PS1="\[\e[1;31m\]\u\[\e[0;34m\]@\h\[\e[0;37m\]\w\[\e[1;31m\]\\$\[\e[m\] "
  79.  
  80. ' > ~/.bashrc &&
  81. sudo cp ~/.bashrc /root/.bashrc &&
  82. echo -e "\e[32m New bashrc created.\e[m" &&
  83. bash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement