当我使用
find . -type f -path ./source/script -prune -o -print;
我在“pruned”./source/script目录中获取文件。
... ./source/script ./source/script/myapp02.4372d2ea3388.Js ./source/script/myapp02.Js ./source/script/myapp02.1798d7bc34d2.Js ...
但是当我使用:
find . -path ./source/script -prune -o -type f -print;
“pruned”目录中的文件被省略:
linuxpipe道参数列表太长
在find -exec中使用别名
使用terminallinux mintfind并复制目录中的所有图像,试图理解语法
从文件名中删除单词列表
./generate.py ./readme.txt ./source/class/myapp02/Application.Js ./source/class/myapp02/Application.Js:75: ./source/class/myapp02/__init__.Js ./source/class/myapp02/Application.Js~ ./source/class/myapp02/theme/Font.Js ./source/class/myapp02/theme/theme.Js ./source/class/myapp02/theme/decoration.Js ./source/class/myapp02/theme/color.Js ./source/class/myapp02/theme/Appearance.Js ./source/class/myapp02/simulation/DemoSimulation.Js ./source/class/myapp02/test/DemoTest.Js ./source/translation/readme.txt ./source/index.HTML ./source/index.HTML~ ./source/resource/myapp02/test.png ./Manifest.Json ./config.Json
在另一个例子中,我看到:
find . -type d ( -path dir1 -o -path dir2 -o -path dir3 ) -prune -o -print
我看到的唯一区别是-type d在我的代码-type f 。
这是为什么-prune被忽略,find程序在“pruned”目录中search的唯一原因?
find . -type f -path ./source/script -prune -o -print;
被解释为
find . (-type f AND -path ./source/script AND -prune) OR (-print);
find . -path ./source/script -prune -o -type f -print;
被解释为
find . (-path ./source/script AND -prune) OR (-type f AND -print);
请注意, -print和-prune是表达式,其值为true 。
因此,如果(-path ./source/script AND -prune)为真,那么(-type f AND -print)不会被评估, -print也不会被调用。 并且`(-path ./source/script AND -prune)对./source/script所有文件和子目录都是./source/script
总结以上是内存溢出为你收集整理的如何正确使用修剪? -type d和-type f对修剪有不同的影响?全部内容,希望文章能够帮你解决如何正确使用修剪? -type d和-type f对修剪有不同的影响?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)