Posted By

cruelfate on 11/18/10


Tagged

Bash


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Affix


My .bashrc


 / Published in: Bash
 

  1. # loads o' history from many shells at same time
  2. export HISTSIZE=10000
  3. export HISTFILESIZE=1000000
  4. export EDITOR=emacs
  5. export PROMPT_COMMAND='history -a'
  6. shopt -s histappend
  7.  
  8. # meh aliases
  9. alias cp='cp -i'
  10. alias mv='mv -i'
  11. alias rm='rm -i'
  12. alias rot13='tr A-Za-z N-ZA-Mn-za-m'
  13.  
  14. # teh sxy prmpt ftn
  15. function echo_prompt ( ) {
  16. local DEFAULT_COLOR='\[\e[0m\]'
  17. local GREEN='\[\e[0;32m\]'
  18. local RED='\[\e[0;31m\]'
  19. local YELLOW='\[\e[1;33m\]'
  20. local LGREEN='\[\e[1;32m\]'
  21. local PURPLE='\[\e[0;35m\]'
  22. local TIME="${GREEN}\t"
  23. local RET_CODE="${RED}(\$?)"
  24. local USER="${LGREEN}\u@\h"
  25. local PWD="${YELLOW}\w"
  26. local TITLE='\[\e]0;\u@\h \w\]'
  27. if [ ! -z "${CLEARCASE_ROOT}" ]; then
  28. local CC_VIEW="${PURPLE}[$(basename $CLEARCASE_ROOT)]"
  29. echo "${TITLE}\n${TIME} ${RET_CODE} ${USER} ${CC_VIEW} ${PWD}\n\$ ${DEFAULT_COLOR}"
  30. else
  31. echo "${TITLE}\n${TIME} ${RET_CODE} ${USER} ${PWD}\n\$ ${DEFAULT_COLOR}"
  32. fi
  33. }
  34.  
  35. ls_color_opt=""
  36.  
  37. case "$TERM" in
  38. 'xterm' | 'dtterm' | 'ansi' | 'vt102' | 'rxvt' | 'cygwin' )
  39. if [ `uname` = 'Linux' ] ; then
  40. ls_color_opt=true
  41. fi
  42. PS1=$( echo_prompt )
  43. ;;
  44. 'dumb' | * )
  45. export PS1="\u@\h \w\n\$ "
  46. ;;
  47. esac
  48.  
  49. if [ ! -z "${ls_color_opt}" ]; then
  50. alias l='ls -FC --color'
  51. alias la='ls -aFC --color'
  52. alias ll='ls -lF --color'
  53. alias lla='ls -alF --color'
  54. else
  55. alias l='ls -FC '
  56. alias la='ls -aFC'
  57. alias ll='ls -lF'
  58. alias lla='ls -alF'
  59. fi

Report this snippet  

You need to login to post a comment.