从find
手册页:
-exec command ; There are unavoidable security problems surrounding use of the -exec action; you should use the -execdir option instead. -execdir command {} + Like -exec, but the specified command is run from the subdirectory containing the matched file, which is not normally the directory in which you started find. This a much more secure method for invoking commands, as it avoids race conditions during resolution of the paths to the matched files.
这是什么意思?从开始目录运行它为什么会有竞争条件?这些安全风险如何?
相关:为什么遍历find的输出是不好的做法?在某些答案中涵盖了这些内容。
—
斯特凡Chazelas