Monday, January 21, 2013

function in .bashrc

There are bunch of thing you can do with bash.

This one is easiest and I use it more than a lot..

Which is Function in bash!


mygrep() { grep -RHni --exclude=.git --exclude=svn "$@" . 2> /dev/null; }

So this is basically using grep with your argument.

when you trying to find "hello" in your folder

you type "grep -RHn hello . 2> /dev/null" something like this.

with mygrep function

you can only type "mygrep hello" well that's it.

cause mygrep redirect to mygrep function in bash :)