English 中文(简体)
解释有多少进程?
原标题:Explain how many processes created?

Could someone answer how many processes are created in each case for the commands below as I dont understand it :

以下三个指挥机构具有大致相同的效果:

  1. rm $(find . -type f -name *.o )
  2. find . -type f -name *.o | xargs rm
  3. find . -type f -name *.o -exec rm {} ;
最佳回答
  1. Exactly 2 processes - 1 for rm, the other for find.
  2. 3 or more processes. 1 for 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).
  3. Many processes, 1 for find and another one for each file ending in .o for rm.

我认为,备选方案2是最好的,因为它正确地处理最大参数限制,并且 too开太多的过程。 然而,我更喜欢这样使用(在民盟发现和xargs的情况下):

find . -type f -name  *.o  -print0 | xargs -0 rm

这终止了每个档案名称的“<>/code>,而不是一条新线,因为UNIX的档案名称在法律上可以有新线。 这也正确地处理档案名称中的空间(比较常见)。

问题回答

暂无回答




相关问题
KornShell- Creating a fixed width text file

I need to create a simple fixed width text file in KornShell (ksh). My current attempt using printf to pad the string isn t working out very well. What s the shortest, cleanest way to create a fixed ...

unix find command

how to use the find command to find files/directories which are not matching the pattern. for eg: find <some options > -name "dontfile.txt" should give me output of all the find whose file ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Case insensitive comparison of strings in shell script

The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?

1. 露台式照像

在Windows XP中,没有一时出现指挥时,是否有办法操作一种灰色文字? 我常常需要把“善待”(工作)与“灰色”同起来,即使我的文字没有产出,......