grep-color.sh 523 B

1234567891011121314151617181920212223242526
  1. #!/bin/bash
  2. scriptname=$(basename ${BASH_SOURCE[0]})
  3. scriptdirname=$(dirname ${BASH_SOURCE[0]})
  4. function debug () {
  5. if [ -n "$DEBUG" ]; then
  6. echo -e "$*" >&2
  7. fi
  8. }
  9. debug "Colorizing grep aliases."
  10. ## Colorize the grep command output for ease of use (good for log files)##
  11. if [ -n "$(command -v grep)" ]; then
  12. alias grep='grep --color=auto'
  13. fi
  14. if [ -n "$(command -v grep)" ]; then
  15. alias egrep='egrep --color=auto'
  16. fi
  17. if [ -n "$(command -v grep)" ]; then
  18. alias fgrep='fgrep --color=auto'
  19. fi