問題:
1.為什么第2條find少了-print選項(xiàng),結(jié)果會(huì)多出一個(gè)"./databak"?
2.-print是find命令默認(rèn)選項(xiàng)嗎?作者: songyc_2015 時(shí)間: 2015-04-20 23:56
知道答案了,因?yàn)椋?br />
The expression is made up of options (which affect overall operation rather than the processing of a specific file, and always return true),
tests (which return a true or false value), and actions (which have side effects and return a true or false value), all separated by operators.
-and is assumed where the operator is omitted.
If the expression contains no actions other than -prune, -print is performed on all files for which the expression is true.
所以:一下命令是等價(jià)的:
find ./ \( -name "databak" -prune \) -o -name "*20150408*" -type f
find ./ \( \( -name "databak" -a -prune \) -o \( -name '*20150408*' -a -type f \) \) -a -print
find ./ \( -name "databak" -prune -a -print \) -o -name "*20150408*" -type f -a -print