Could someone answer how many processes are created in each case for the commands below as I dont understand it :
以下三个指挥机构具有大致相同的效果:
rm $(find . -type f -name *.o )
find . -type f -name *.o | xargs rm
find . -type f -name *.o -exec rm {} ;
Could someone answer how many processes are created in each case for the commands below as I dont understand it :
以下三个指挥机构具有大致相同的效果:
rm $(find . -type f -name *.o )
find . -type f -name *.o | xargs rm
find . -type f -name *.o -exec rm {} ;
rm
, the other for find
.find
, another for xargs
, and one or more rm
. xargs
will read standard input, and if it reads more lines than can be passed as parameters to a program (There is a maximum value named ARG_MAX
).find
and another one for each file ending in .o
for rm
.我认为,备选方案2是最好的,因为它正确地处理最大参数限制,并且 too开太多的过程。 然而,我更喜欢这样使用(在民盟发现和xargs的情况下):
find . -type f -name *.o -print0 | xargs -0 rm
这终止了每个档案名称的“