查找文件命令find的exec选项使用

  find命令的 -exec 选项可以将find的结果作为参数来执行其他命令,具体用法可参见帮助文档:

 

-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. The command line is built in much the same way
that xargs builds its command lines. Only one instance of ’{}’
is allowed within the command. The command is executed in the
starting directory.

find . -type f -exec ls -l {} \;

 

  需要注意的是,其中的“{}”代表find的结果,后面的“\”是必须的,尤其要注意语句中的空格,如果使用不当很容易产生 

find: 遗漏“-exec”的参数   类似的问题。

你可能感兴趣的:(F#)