This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -exec on find(1) broken


On 2007-10-09, Paul McFerrin wrote:
> I think I'm going nuts.  What am I doing wrong?  Can't seem to get -exec to 
> work.
>
>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo \{\;\} | more
>    find: missing argument to `-exec'
>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo \{\} | more    find: 
> missing argument to `-exec'
>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo '\;' | more
>    find: missing argument to `-exec'
>    /i/mp3.$ find . -type f -mtime +18 -exec /bin/echo \{;\} | more
>    find: missing argument to `-exec'
>    /i/mp3.$ find . -type f -mtime +18 -exec echo '\;' | more
>    find: missing argument to `-exec'
>
> There is NO missing argument to -exec.  What gives?  Is it really broken or 
> do I not understand the manual page correctly?

You're putting too many quotes around the semicolon.  Use

   \;

or

   ';'

but not both.  For example,

   find . -type f -mtime +18 -exec /bin/echo \; | more

If you want to echo the name of each file found, use {} like this:

   find . -type f -mtime +18 -exec /bin/echo {} \; | more

However, if that's all you want to do, the -exec isn't 
necessary--just use -print:

   find . -type f -mtime +18 -print | more

In modern implementations of find, such as Cygwin's, the -print 
usually isn't necessary either, so you could get by with just this:

   find . -type f -mtime +18 | more

Also, please don't start new threads by replying to other posts--it 
messes up threading.  Send mail directly to the list instead.

Regards,
Gary

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]