- 论坛徽章:
- 93
|
回复 2# waker
谢谢 waker,你的那句话是哪里的说明,不会是 find 的源码说明吧,那太高深我是接触不到的,我在 find 的 man 中没有看到。
虽然说英文单词都认识,还是不大理解这句话的意思
The exec() family of functions replaces the current process image with a new process image.
理解成中文:exec()这一族的函数会用新的进程映像替换当前进程映像。是说用 -exec 后的命令替换了 find 命令进行执行吧?
这个exec的原义,我们就附会一下吧,
当find去exec continue时,去哪里找continue的image?
从执行的提示“没有那个文件或目录”来看,应该是指没有“continue”这个“文件”用于 -exec 的执行,也就是说 -exec 需要找到一个实实在在的命令文件来进行执行,这个“实实在在”的文件就是你说所的那个“image”吧?
综合来理解也就是说 -exec 是需要一个有“物理实体”的命令来做参数,所以内建命令就用不上了。
man find 里没有对 command 有什么限制的说明:- -exec command ;
- Execute command; true if 0 status is returned. All following arguments to find are taken to be
- arguments to the command until an argument consisting of ‘;’ is encountered. The string ‘{}’ is
- replaced by the current file name being processed everywhere it occurs in the arguments to the
- command, not just in arguments where it is alone, as in some versions of find. Both of these con-
- structions might need to be escaped (with a ‘\’) or quoted to protect them from expansion by the
- shell. See the EXAMPLES section for examples of the use of the ‘-exec’ option. The specified
- command is run once for each matched file. The command is executed in the starting directory.
- There are unavoidable security problems surrounding use of the -exec option; you should use the
- -execdir option instead.
复制代码 |
|