delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/02/22:57:44

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <5.1.0.14.2.20020802194952.01f999f0@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Fri, 02 Aug 2002 19:59:00 -0700
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: Easy, quick, BASH question
In-Reply-To: <3D4AD945.16923.ADB067@localhost>
References: <C69F6A9E1E1F5A488C58B168F0875F4006B80CAB AT riv-exch1 DOT echostar DOT com>
Mime-Version: 1.0

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/

- Raw text -


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