complex find command

Hi all,
I am trying to execute the following command:

find 'path' -ls -exec cksum {} \;

As you can see this simply finds files from a given path and runs cksum on them.
My problem is this, if i have a FIFO in a directory the find tries to execute cksum on it and gets stuck.
From the man page i understood that i cannot use -type and -exec together
so i am quite stuck here.
any ideas?

Hi.

You can indeed use type and exec together.

find 'path' -type f -ls -exec cksum {} \

The man page of which OS gave you that idea? I just checked on HP-UX and Linux, and neither -type nor -exec are mentioned in the description of the other. Just try it.

Thank you for answering,
It is possible to use them together but when you use them together it is undefined who goes first. Sometimes first the type will be checked and then the exec activted and sometimes the other way around.

---------- Post updated at 06:53 AM ---------- Previous update was at 06:52 AM ----------

the solaris man page.
Solaris 5.10

---------- Post updated at 06:54 AM ---------- Previous update was at 06:53 AM ----------

Using -type is not sufficient to restrict the  type
     of  files on which the -exec command operates, because there
     is an inherent race condition between  the  type-check  per-
     formed by the find command and the time the executed command
     operates on the file argument.

---from the man page

Hi.

The exec will be done depending on its place in the command. If you put it after the directory, filename, and type, etc. then it will after those are evanulated.

I've never experienced where the order is "underfined".

Thank you scottn i will try it

All variants of find I've encountered so far were left-associative, meaning the expressions were applied from left to right (following boolean order)

---------- Post updated at 14:09 ---------- Previous update was at 14:07 ----------

I think the race condition mentioned means that there is no guarantee that between the type check and the exec the entry doesn't change.

Yes, I think so.

From the specification for the exec option:

find

I can't see the point of the "-ls" switch in this context.

find /directory/ -type f -exec cksum {} \;

For listing, he used -ls instead of -print. I hope so.