This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Easy, quick, BASH question
Stephen,
By using the "$PWD" argument, your suggestion will result in absolute
path-names being generated and passed to grep. It's not a wrong or right
issue, of course--in some circumstances that might be desirable, in others not.
Also, by forking a separate process for each file, this approach generates
pretty high overhead by comparison with the other suggestions that have
been proffered.
And again, the "$*" will not work correctly if more than one argument is
given to this definition of "hcgrep." "$@" is the proper way to pass
multiple, individually quoted options to the invocation(s) of grep.
Randall Schulz
Mountain View, CA USA
At 19:11 2002-08-02, Stephen C. Biggs wrote:
$ function hcgrep()(find "$PWD" -name "*.[ch]" -type f -exec grep -n -H
"$*" {} \;)
$ hcgrep include
... works.
According to the "man" page for bash, alias does not take arguments.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/