This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Defining an 'rgrep' function


Eric,

The problem is not the backslash escaping the semicolon, it's the fact that 
the body of a BASH function must end either with a newline or a semicolon. 
Your removing the backslash allowed BASH to see it and properly parse the 
function definition. However, this effectively "stole" it from find, which 
then became the complainant.

So, you want this:

rgrep () { find . -name "*.[ch]" -type f -exec egrep -n "$1" {} /dev/null 
\; ; }

RandyS


At 11:01 3/2/2001, Eric M. Monsler wrote:
>Hi,
>
>I am trying to define a recursive grep function, rgrep.
>
>On Solaris, I use:
>
>function rgrep { find . -name "*.[ch]" -type f -exec egrep -n "$1" {}
>/dev/null \; }
>
>Under cygwin, that is not parsed correctly.  I suspected that it was due
>to the "\" character, so I tried:
>
>function rgrep { find . -name "*.[ch]" -type f -exec egrep -n "$1" {}
>/dev/null ; }
>
>The above seemed to be parsed correctly, but doing "rgrep foo" returned
>the error message:
>
>find: missing argument to `-exec`
>
>
>So, there are two questions that come to mind:
>
>1) How do I modify the function definition in bash/cygwin, so that "\;"
>is interpreted as it is on Solaris?
>
>2) Does anyone have a working rgrep function I an just steal, and remain
>ignorant? :)
>
>
>Eric M. Monsler


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]