[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strange behaviour of find -iname
From: |
Eric Blake |
Subject: |
Re: strange behaviour of find -iname |
Date: |
Tue, 27 Mar 2018 08:41:12 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 03/27/2018 05:28 AM, address@hidden wrote:
Hello!
I am not sure this is a bug, but I fail to understand why find -iname
works differently according to the directory where I want to find
something...
Not a bug in find, but in your usage.
address@hidden /home # find -iname *astrill*
Insufficiently quoted. Try
echo find -iname *astrill*
to see what you are really executing. If your current directory has
nothing that satisfies the glob, then find sees a single argument, and
does what you want.
address@hidden / # find -iname *astrill*
find: paths must precede expression: 20180327_astrill_before_update
But if you execute it in a directory where the glob expands to more than
one file, then you really executing something like:
find -iname ':astrill:' '_astrill_'
(I'm guessing here as to what the glob actually expanded to, but you can
use echo to see for sure).
What you WANTED to type was:
find -name '*astrill*'
which forces the shell to treat the argument as a literal rather than a
glob, so that find can then match the glob.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org