PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] Command-Line Arguments
Date: Thursday, 03 Sep 2020, 08:44:50


    > Message Posted By: Anonymous
    >
    > I have a few questions about how to process certain command-line arguments:
    > -Does the order of options, tests, actions, and operators matter? (i.e.
    > Does an operator have to sit between two tests, or can it be anywhere in
    > the command-line?)

Yes, the order may matter.
=====

    > --Are operators only allowed when there are 2+ tests specified?

Yes, every EXPLICIT operator (-o or -a) must have both
left and right operands.  (Remember that there is an
implicit -a between successive options/tests/actions.)
=====

    > --Can we assume that multiple {}s may appear for a single exec command?

Yes, {} may appear more than once in a single -exec.
=====

    > --What's the difference in how we traverse the directories if -depth is
    > specified vs. when there are no options (depth or maxdepth) specified?

As stated in "man find',

  -depth Process each directory's contents before the  directory  itself.

Thus if -depth is specified, the traversal is postorder;
otherwise it is preorder.
=====

    > --If -print is not specified, do we write nothing to stdout?

As stated in the specification

  * Perform the -print action whenever EXPRESSION does not contain any actions
    and the value of EXPRESSION is true.

--Stan-
PREV INDEX NEXT