Unix administration - question on find -exec

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > January 2004 > question on find -exec





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author question on find -exec
Lu

2004-01-23, 5:10 pm

Hi,

I am trying to change some UID's. I googled around and found the
following command to use:
find / -user 1000 -print -exec chown -h 5000 {} \;
It worked great. But I don't understand what the "{} \;" does. Can
anyone tell me what that is?

Also, I tried to put it in a script, I got error message "missing
argument". What should I do to put it in scripts? Here's how it showed
up in the script:
#/bin/sh
find / -user 1000 -print -exec chown -h 5000 {} \\\;

Thanks a lot,

Lu
Davide Bianchi

2004-01-23, 5:10 pm

Lu <lsun91125@yahoo.com> wrote:
quote:

> It worked great. But I don't understand what the "{} \;" does.



man find will tell, anyway the {} bit get subsituted with the
file/directory find just found and \; means "here the previous
command ends".
quote:

> Also, I tried to put it in a script, I got error message "missing
> argument".



Do not escape the ''.

Davide
Lu

2004-01-23, 5:10 pm

Thanks a lot Davide. I made it to work in the script. I don't need any
more escape character.

Lu
Bill Marcum

2004-01-23, 5:10 pm

On 8 Dec 2003 07:06:05 -0800, Lu
<lsun91125@yahoo.com> wrote:
quote:

> Hi,
>
> I am trying to change some UID's. I googled around and found the
> following command to use:
> find / -user 1000 -print -exec chown -h 5000 {} \;
> It worked great. But I don't understand what the "{} \;" does. Can
> anyone tell me what that is?
>


man find
Find replaces the {} with each filename that it finds, and the \;
marks the end of the "-exec" arguments.

--
Thanks to Nigeria, any email with the word "urgent" in the subject
or address will be deleted.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com