public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Stroller <stroller@stellar.eclipse.co.uk>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Search filesystem with a wildcard
Date: Sun, 27 Feb 2011 06:52:36 +0000	[thread overview]
Message-ID: <19030C9F-4C52-44C2-9E32-F01285EBC55B@stellar.eclipse.co.uk> (raw)
In-Reply-To: <73cb39da-826b-4754-91f4-40e9656fe961@ZABRYSVISEXHUB2.af.didata.local>


On 27/2/2011, at 6:30am, Alan McKinnon wrote:
> On Sunday 27 February 2011 03:46:48 Stroller wrote:
>> On 26/2/2011, at 5:33pm, Grant wrote:
>>> 
>>> find /my/folder -type f -name '*foo*.txt'
>> 
> 
> He didn't quote the search string and neither did the grandparent. Find will 
> do what he's asking and it's most unlikely that's what he wants.
> 
> Grant, you have
> 
> find /my/folder -name foo*.txt
> 
> but you want
> 
> find /my/folder -name 'foo*.txt'

AIUI using `find /my/folder -name foo*.txt` (i.e. unquoted) the shell will pass the * to find if it can't expand it itself.

So as long as he doesn't have a foo*.txt in his current working directory then either command should work fine.

$ ls my/folder/
foo.txt
$ ls foo.txt 
foo.txt
$ rm foo.txt 
$ find my/folder -name foo*.txt
my/folder/foo.txt
$ ls fo*.txt
ls: cannot access fo*.txt: No such file or directory 
$ find my/folder -name fo*.txt
my/folder/foo.txt 
$ find my/folder -name *fo*.txt
my/folder/foo.txt
$ find my/folder -name '*fo*.txt'
my/folder/foo.txt
$ 

I maintain that if OP wanted useful advice he should have demonstrated stuff like the outputs of his find commands and of `ls foo*.txt` and `ls /my/folder/foo*.txt`. I am getting tired of giving this advice here.

Stroller.




  parent reply	other threads:[~2011-02-27  7:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26  2:26 [gentoo-user] Search filesystem with a wildcard Grant
2011-02-26  3:19 ` Amankwah
2011-02-26  4:33   ` Mike Gilbert
2011-02-26 10:24   ` Roman Zilka
2011-02-26 17:33   ` Grant
2011-02-26 18:26     ` luis jure
2011-02-26 21:45     ` Roman Zilka
2011-02-27  3:46     ` Stroller
     [not found]       ` <73cb39da-826b-4754-91f4-40e9656fe961@ZABRYSVISEXHUB2.af.didata.local>
2011-02-27  6:52         ` Stroller [this message]
2011-02-27 11:29           ` Willie Wong
2011-02-27 19:32       ` Grant
2011-02-26  3:23 ` Mike Gilbert
2011-02-26 17:16   ` Grant
2011-03-01  0:58     ` Grant
2011-03-01  2:11       ` Alex Schuster
2011-03-01 17:56         ` Grant

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=19030C9F-4C52-44C2-9E32-F01285EBC55B@stellar.eclipse.co.uk \
    --to=stroller@stellar.eclipse.co.uk \
    --cc=gentoo-user@lists.gentoo.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