This should be a simple thing to accomplish, but I can seem to figure it out.
Essentially, I want to have a bash alias or function that will let me recursively grep the current directory.
A while back I added this to my .bashrc:
alias rg="grep -r --exclude=\*/.svn/\* --exclude=\*.swp"
This works fine, (and also ignores any svn and vim swp files), and I can call it like:
However, 99.999% of the time, I am only interested in searching in the current directory, so the "*" is a bit redundant. Also, I would say 5-10% of the time, I am typing faster than thinking and forget the "*", so grep just sits there trying to read from stdin.
It's a pretty minor thing, but ideally I'd like to be able to just type:
I've tried creating a function to handle this:
grep -r --exclude=\*/.svn/\* --exclude=\*.swp $1 *
but it behaves exactly the same as the alias above. escaping the "*" with \'s doesn't work, and neither does trying `pwd` (or even a hard-coded path) in its place.
My bash skills are pretty rudimentary, so I assume that I'm missing something basic here.