0

Replace grep command with grep -n --colour?

is there anything similar for rgrep auto color?

epsilon8
  • 121
  • 9

2 Answers2

2

add this line to your .bashrc in your home directory

alias rgrep="grep -n --colour"
0

Just execute the following lines and modify one line as describe bellow

mkdir -p ~/bin
cd ~/bin
wget http://sdjf.esmartdesign.com/files/rgrep
chmod +x rgrep

Edit it and modify the line

args=${args:--His}

To this version:

args="${args:--His} --color=auto"
David Foerster
  • 35,754
  • 55
  • 92
  • 145
mnono
  • 41
  • 1
  • This appears to be a comment on another answer rahter than a complete answer. – Elder Geek Dec 17 '14 at 16:47
  • Hi Elder, Doing like this permit to always use rgrep with color... Wasn't it the original ask? – mnono Dec 23 '14 at 16:34
  • Actually the original question *as I understood it* appeared to be looking for something **similar to** rgrep auto color. Perhaps I misunderstood. – Elder Geek Dec 24 '14 at 01:08
  • Thanks for the modifications, it's clearest. (I didn't knew the p option on mkdir.) To complete, if not working (command not found), add ``` export PATH=$PATH:~/bin ``` into one of the autoloaded configuration file (~/.bashrc or ~/.zshrc or else depending of your distribution) – mnono Jan 02 '15 at 10:13