> For one, the path argument comes before any options or flags.
Actually, it does conform to unix conventions:
find [OPTIONS] [PATHS] [EXPRESSION]
Where options are "-PLHDO" in the GNU version. The elements of EXPRESSION may be introduced by a dash, but they're not really options. Together, they specify a little program to evaluate on every path. The program could have easily taken the form 'type f a name foo' instead of '-type f -a -name foo'. The only issue would be recognizing the end of PATHS arguments and the beginning of EXPRESSION arguments...perhaps that's why the dash is used? It does seem like OPTIONS EXPRESSION [--] PATHS would be easier and less ambiguous to parse.
> Also, what is the point of the '-print' option? Pretty much every other utility prints results to stdout by default.
find does print to stdout by default. Perhaps -print was added later to distinguish the default mode from -print0, which is common when pairing with xargs.
> I welcome any historical context or clarification if my expectations are in fact flawed.
I was kind of hoping the recently rehabilitated UNIX 1972 sources would shed some light on your questions. Unfortunately, find is present but only as a PDP-11 executable [1].
find ... -exec $cmd '{}' \; # calls $cmd once for each match
find ... -exec $cmd '{}' + # calls $cmd with as matches as possible - minimising number of invocations of $cmd.
I think this is either reasonably new, or not entirely standard, since I've used versions that don't have it.
-ok $cmd \;
is also pretty neat - same as exec, but asks for confirmation first.
Actually, it does conform to unix conventions:
Where options are "-PLHDO" in the GNU version. The elements of EXPRESSION may be introduced by a dash, but they're not really options. Together, they specify a little program to evaluate on every path. The program could have easily taken the form 'type f a name foo' instead of '-type f -a -name foo'. The only issue would be recognizing the end of PATHS arguments and the beginning of EXPRESSION arguments...perhaps that's why the dash is used? It does seem like OPTIONS EXPRESSION [--] PATHS would be easier and less ambiguous to parse.> Also, what is the point of the '-print' option? Pretty much every other utility prints results to stdout by default.
find does print to stdout by default. Perhaps -print was added later to distinguish the default mode from -print0, which is common when pairing with xargs.
> I welcome any historical context or clarification if my expectations are in fact flawed.
I was kind of hoping the recently rehabilitated UNIX 1972 sources would shed some light on your questions. Unfortunately, find is present but only as a PDP-11 executable [1].
[1] http://code.google.com/p/unix-jun72/source/browse/#svn%2Ftru...