find: incomplete statement

I can execute the following command on local machine:

find / -user 10002 -exec chown 35645 {} \;

I am trying to do the following


I got the following error

"find: incomplete statement"

I even tried
rsh ba123 /usr/bin/find / -user 10002 -exec chown 35645 {} \;

I got the same problem.

What I am doing wrong? Any fixes? Thanks.
heylow [ Do, 25 Oktober 2007 23:30 ] [ ID #1853920 ]

Re: find: incomplete statement

2007-10-25, 21:30(-00), heylow:
> I can execute the following command on local machine:
>
> find / -user 10002 -exec chown 35645 {} \;
>
> I am trying to do the following
>
>
> I got the following error
>
> "find: incomplete statement"
>
> I even tried
> rsh ba123 /usr/bin/find / -user 10002 -exec chown 35645 {} \;
>
> I got the same problem.
>
> What I am doing wrong? Any fixes? Thanks.

rsh calls a shell on the remote machine and tells it to
interpret a command line that is a concatenation of the
arguments passed to "rsh machine". So in

> rsh ba123 /usr/bin/find / -user 10002 -exec chown 35645 {} \;

It asks a shell on ba123 to interpret:

"/usr/bin/find / -user 10002 -exec chown 35645 {} ;"

What that means is that you need to escape ";" twice. Once for
the local shell and once for the remote one:

rsh ba123 '/usr/bin/find / -user 10002 -exec chown 35645 {} \;'
or
rsh ba123 /usr/bin/find / -user 10002 -exec chown 35645 {} \\\;
for instance.

--
Stéphane
Stephane CHAZELAS [ Do, 25 Oktober 2007 23:34 ] [ ID #1853921 ]

Re: find: incomplete statement

On Oct 25, 5:34 pm, Stephane CHAZELAS <this.addr... [at] is.invalid> wrote:
> 2007-10-25, 21:30(-00), heylow:
>
>
>
> > I can execute the following command on local machine:
>
> > find / -user 10002 -exec chown 35645 {} \;
>
> > I am trying to do the following
>
> > I got the following error
>
> > "find: incomplete statement"
>
> > I even tried
> > rsh ba123 /usr/bin/find / -user 10002 -exec chown 35645 {} \;
>
> > I got the same problem.
>
> > What I am doing wrong? Any fixes? Thanks.
>
> rsh calls a shell on the remote machine and tells it to
> interpret a command line that is a concatenation of the
> arguments passed to "rsh machine". So in
>
> > rsh ba123 /usr/bin/find / -user 10002 -exec chown 35645 {} \;
>
> It asks a shell on ba123 to interpret:
>
> "/usr/bin/find / -user 10002 -exec chown 35645 {} ;"
>
> What that means is that you need to escape ";" twice. Once for
> the local shell and once for the remote one:
>
> rsh ba123 '/usr/bin/find / -user 10002 -exec chown 35645 {} \;'
> or
> rsh ba123 /usr/bin/find / -user 10002 -exec chown 35645 {} \\\;
> for instance.

Thank you, St=E9phane.
heylow [ Fr, 26 Oktober 2007 01:17 ] [ ID #1854874 ]
Linux » comp.unix.shell » find: incomplete statement

Vorheriges Thema: Find and replace in many files
Nächstes Thema: grep util ? on binary files