bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Potential linux find utility bug / misdocumentation


From: Eric Blake
Subject: Re: Potential linux find utility bug / misdocumentation
Date: Mon, 6 Feb 2017 12:41:48 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 02/06/2017 08:31 AM, David Jamroga wrote:

> address@hidden ~]$ find . -iname Bon*
> 
> ./BonAirPainting
> 
> address@hidden ~]$ find . -iname bon*
> 
> ./MiscNetflix/bonbon.txt
> 
> ./BonAirPainting

Not a bug in find, but in your usage.  You forgot to use proper shell
quoting.  So you ended up executing:

find . -iname BonAirPainting

vs.

find . -iname 'bon*'

when you REALLy wanted to execute:

find . -iname 'Bon*'

in the first instance.  To prove this, rewrite your command lines to:

echo find . -iname Bon*
echo find . -iname bon*

and also play with what happens when you do:

touch bon1 bon2

and watch the behavior change yet again into a syntax error when you use
insufficient quoting.  Remember, find is one of the (few) programs where
you WANT to let 'find' do glob expansion, rather than the shell, making
it important to always quote the arguments so that the shell doesn't
prematurely expand things.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]