Subject: Suspected bug in find -exec '+'

From: "Richard White" <[email-masked]>
Date: Mon, 19 Oct 2015 12:33:34 +0100

The find utility supports execution of a nominated command per file found.  The command argument list is terminated with a ';' parameter.

The enhanced GNU version specifies an alternative version of the –exec option using a '+' list terminator.  This option is provided to support an xargs-like batched execution of the nominated command resulting in greater efficiency.

It seems like find –exec ';' and find –exec '+' do not behave consistently with regard to '{}' argument expansion.  

An example:

mkdir /tmp/test

cd /tmp/test

touch a b

find . –type f –exec echo Prefix{}Suffix ';'

è Prefix./bSuffix

è Prefix./aSuffix

find . –exec echo Prefix{}Suffix '+'

è ./b ./a

Is the latter result correct?  I would have expected the same result as for the ';' version?

Richard White

Embedded

Expertise

Richard White, Director,  <http://www.embedded-expertise.com/> Embedded Expertise Ltd

 <mailto:[email-masked]> [email-masked]

t: +44 (0) 333 112 8740  m: +44 (0) 7973 393348