delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/03/02/15:26:16

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-Id: <5.0.2.1.2.20010302121935.03407ea8@ks.teknowledge.com>
X-Sender: rschulz AT ks DOT teknowledge DOT com
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Fri, 02 Mar 2001 12:25:36 -0800
To: "Eric M. Monsler" <emonsler AT beamreachnetworks DOT com>,
"cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
From: Randall R Schulz <rschulz AT teknowledge DOT com>
Subject: Re: Defining an 'rgrep' function
In-Reply-To: <3A9FEDF6.FF320851@beamreachnetworks.com>
Mime-Version: 1.0

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019