find command question

Josh Carroll josh.carroll at gmail.com
Thu Apr 9 18:14:46 UTC 2009


On Thu, Apr 9, 2009 at 8:01 AM, Jay Hall <jhall at socket.net> wrote:
> When using the find command with the -exec option, does the find command
> wait for the command being executed to finish before returning the next
> result?
>
> For example, if I am using find -exec {} to copy files to tape, will find
> wait for the command to write the file to tape complete before it returns
> the next result?

It has to wait. It's easily verified by creating a simple script:

#!/bin/sh

echo "My args were: $*"
sleep 1

Then:

find /some/path -exec /path/to/f.sh {} \;

You'll see:

My args were: /some/path/a
(1 second delay)
My args were: /some/path/b
(1 second delay)
...

Regards,
Josh


More information about the freebsd-questions mailing list