Author: Stan Eisenstat
Subject: Re: [Cs323] -depth and -maxdepth
Date: Sunday, 13 Sep 2020, 10:39:37
> Message Posted By: Unknown > > The spec says "options (-depth and -maxdepth), which affect the overall > traversal (rather than the evaluation of EXPRESSION)". However, running > staff solution seems to suggest that -depth and -maxdepth do affect the > evaluation of EXPRESSION. For example, running "/c/cs323/Hwk1/fiend -depth > -o -maxdepth 1 -exec echo file \;" doesn't execute the "echo..." command, > presumably since -depth already returns true, whereas running > "/c/cs323/Hwk1/fiend -exec echo file \; -o -maxdepth 1" does execute > "echo...". So to clarify, should we take into account the "true" returned > by "-depth" and "-maxdepth" while evaluating an expression? As stated in the specification, + options (-depth and -maxdepth), which affect the overall traversal (rather than the evaluation of EXPRESSION) and always return true: If you ignore the effect of -depth on the overall traversal and remove it from EXPRESSION, the command /c/cs323/Hwk1/fiend -depth -o -maxdepth 1 -exec echo file \;" becomes /c/cs323/Hwk1/fiend -o -maxdepth 1 -exec echo file \;" which results in an error message since -o does not have a left operand. Thus the only effect of -depth (other than to specify postorder traversals) is to avoid that error message and let the traversals take place. If you would like to discuss this point further, please contact me directly. I will no longer respond via the newsgroup. Thanks. --Stan-PREV INDEX NEXT