From: * Tong * on
Hi,

I get "find: missing argument to `-exec'" for the following command but I
don't know how to fix:

find /other/path ! -group grp -exec ln -s {} dest +

please help. thanks

--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/


--
Posted via a free Usenet account from http://www.teranews.com

From: Michael Tosch on
* Tong * wrote:
> Hi,
>
> I get "find: missing argument to `-exec'" for the following command but I
> don't know how to fix:
>
> find /other/path ! -group grp -exec ln -s {} dest +
>
> please help. thanks
>

Most implementations of + require it to immediately follow the {}
Otherwise, use \; rather than +

You have another problem with the ln command and the static "dest":
if find finds two or more files, you will get a "file exists" error.

--
Michael Tosch @ hp : com
From: Stephane CHAZELAS on
2006-12-05, 21:10(+01), Michael Tosch:
> * Tong * wrote:
>> Hi,
>>
>> I get "find: missing argument to `-exec'" for the following command but I
>> don't know how to fix:
>>
>> find /other/path ! -group grp -exec ln -s {} dest +
>>
>> please help. thanks
>>
>
> Most implementations of + require it to immediately follow the {}
> Otherwise, use \; rather than +
>
> You have another problem with the ln command and the static "dest":
> if find finds two or more files, you will get a "file exists" error.
[...]

I think "dest" above is a directory, so you'll get trouble only
if find finds two files having the same name.

To answer the OP's question

find /other/path ! -group grp -exec sh -c '
exec ln -s "$@" dest' arg0 {} +

--
St�phane
From: * Tong * on
On Tue, 05 Dec 2006 20:16:57 +0000, Stephane CHAZELAS wrote:

>>> I get "find: missing argument to `-exec'" for the following command but I
>>> don't know how to fix:
>>>
>>> find /other/path ! -group grp -exec ln -s {} dest +
>
> find /other/path ! -group grp -exec sh -c '
> exec ln -s "$@" dest' arg0 {} +

Thanks for your answers, Stephane.

May I ask why the 1st command fails?

I tried and succeeded with the following command, which looks not much
different than the 1st one:

find /other/path ! -group grp -exec chgrp arch {} +

why? thanks

--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/


--
Posted via a free Usenet account from http://www.teranews.com

From: Stephane CHAZELAS on
2006-12-05, 17:15(-05), * Tong *:
> On Tue, 05 Dec 2006 20:16:57 +0000, Stephane CHAZELAS wrote:
>
>>>> I get "find: missing argument to `-exec'" for the following command but I
>>>> don't know how to fix:
>>>>
>>>> find /other/path ! -group grp -exec ln -s {} dest +
>>
>> find /other/path ! -group grp -exec sh -c '
>> exec ln -s "$@" dest' arg0 {} +
>
> Thanks for your answers, Stephane.
>
> May I ask why the 1st command fails?
[...]

As Michael pointed out, + must follow {}.

See
http://www.opengroup.org/onlinepubs/009695399/utilities/find.html

--
St�phane