以下是什么意思?
find myDirectory -name myFile -exec ls \-ln {} \;
Run Code Online (Sandbox Code Playgroud)
我看过这里,但并不完全明白
-exec command True if the executed command returns a zero value as exit status. The end of command must be punctuated by an escaped semicolon. A command argument {} is replaced by the current path name.
Run Code Online (Sandbox Code Playgroud)
这部分-exec ls \-ln {} \;对我来说并不清楚.
问候
这意味着:查找myFile当前目录及其所有子目录中具有名称的所有文件,以及找到的每个文件都使用文件ls -ln名运行.
例如:
$ mkdir a
$ touch myFile a/myFile
$ find -name myFile -exec ls -ln {} \;
-rw-r--r-- 1 1000 1000 0 Jun 17 13:07 ./myFile
-rw-r--r-- 1 1000 1000 0 Jun 17 13:07 ./a/myFile
Run Code Online (Sandbox Code Playgroud)
在这种情况下find将运行ls两次:
ls -ln ./myFile
ls -ln ./a/myFile
Run Code Online (Sandbox Code Playgroud)
每次它将扩展{}为找到的文件的全名.
另外我必须补充一点,在这种情况下你需要在-ln之前使用反斜杠.是的,你可以使用它,但这里绝对没用.
| 归档时间: |
|
| 查看次数: |
1680 次 |
| 最近记录: |