How do I write an alias for grep -R?
Posted
by numerodix
on Stack Overflow
See other posts from Stack Overflow
or by numerodix
Published on 2010-04-12T09:46:31Z
Indexed on
2010/04/12
16:43 UTC
Read the original article
Hit count: 308
I end up typing
grep -Rni pattern .
and awful lot. How do I make this into an alias like
alias gr='grep -Rni $@ .'
Running that gives:
$ gr pattern
grep: pattern: No such file or directory
Even though the alias looks fine:
$ type gr
gr is aliased to `grep -R $@ .'
It seems that the $@ and the . get swapped when it's actually executed.
© Stack Overflow or respective owner