I want to create an Alias for my Terminal to quick-search inside files.
In Ubuntu is was: alias gre="egrep -rnw "
. I used it like that $ gre 'my search string'
.
Now I want this for my local MacBook-Terminal. I found out that I have to use grep only like this grep -r 'search string' .
How can I add an Alias like the one in Ubuntu?
I think it's something like this: alias gre="grep -r $theTerminalParameter ."
If I test it in the Terminal: alias test="grep -r $var ."
and check the "content" of that alias with alias test
i get that information:
alias test='grep -r .'
so my Variable doesn't appear in the alias.
How can I use an Alias for that task.
Best Answer
You can't use alias for arbitrary substitutions. You can use a function instead.