find 新的 -exec 用法

find 新的 -exec 用法

今日偶得 以后可以少用 xargs 了
复制内容到剪贴板
代码:
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp/find)-
[765 0][/color] [color=red]; ls -l
[/color]total 0
-rw-r--r-- 1 root root 0 2007-02-27 18:10 aa
-rw-r--r-- 1 root root 0 2007-02-27 18:10 bb
-rw-r--r-- 1 root root 0 2007-02-27 18:10 cc
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp/find)-
[765 0][/color] [color=red]; find -type f -exec echo {} \;
[/color]./aa
./bb
./cc
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp/find)-
[765 0][/color] [color=red]; find -type f -exec echo {} +
[/color]./aa ./bb ./cc
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp/find)-
[765 0][/color] [color=red]; find --version
[/color]GNU find version 4.2.27
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp/find)-
[765 0][/color] [color=red]; man find
[/color]       -exec command {} +
              This variant of the -exec option runs the specified  command  on
              the  selected  files, but the command line is built by appending
              each selected file name at the end; the total number of  invoca-
              tions  of  the  command  will  be  much  less than the number of
              matched files.  [color=red]The command line is built in much the  same  way
              that  [u]xargs[/u] builds its command lines[/color].  Only one instance of '{}'
              is allowed within the command.  The command is executed  in  the
              starting directory.
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp/find)-
[765 0][/color] [color=red]; o
[/color]
      
老大真厉害