On 03/27/2018 05:28 AM, r...@gommes.eu 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.
root@ZB17 /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.
root@ZB17 / # 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