linux-console.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: BobGian@U.Washington.edu
To: jeff.holle@verizon.net
Cc: linux-console@vger.kernel.org
Subject: encapulating a find function in a script
Date: Wed, 14 Jan 2004 16:34:01 -0800	[thread overview]
Message-ID: <200401150034.i0F0Y1x17029@trumpet.radonc.washington.edu> (raw)

> I'm having a problem with a simple script I'm trying to develop.
>
> Its name is fgrep and its text is:
>
>         #!/bin/bash
>         find $1 -name $2 -exec grep -H $3 '{}' ';'
>
> I want to use it like "dgrep 'directory' 'file pattern' 'match text'.
>
> It doesn't match anything because of the $2 parameter.  If I replace
> "$2" with "*.cpp", it works.
>
> Can anybody tell me what is wrong and how to fix it?

Try putting double-quotes around the parameters, like:

	 find $1 -name "$2" -exec grep -H "$3" '{}' ';'

This works for me in a similar script, at least in the csh shell.

 -Bob Giansiracusa

             reply	other threads:[~2004-01-15  0:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-15  0:34 BobGian [this message]
2004-01-15  1:00 ` encapulating a find function in a script Mike Castle
2004-01-15  1:55 ` Jeffrey Holle
2004-01-16 21:09   ` Jeffrey Holle
  -- strict thread matches above, loose matches on Subject: below --
2004-01-16 19:53 BobGian
2004-01-16 20:09 ` Mike Castle
2004-01-15  0:19 Jeffrey Holle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200401150034.i0F0Y1x17029@trumpet.radonc.washington.edu \
    --to=bobgian@u.washington.edu \
    --cc=jeff.holle@verizon.net \
    --cc=linux-console@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).