小编Erw*_*ers的帖子

在没有“./”前缀的文件名上使用 find 和 do 命令

cp对多个子目录中的文件名执行 a并foo-为其添加前缀会导致错误:

$ find my-dir -path "*/*" -execdir sh -c 'cp {} foo-{}' \;
cannot create regular file ‘foo-./blabla.jpg’: No such file or directory
Run Code Online (Sandbox Code Playgroud)

在 macOS 上,我没有得到这个./前缀,而且命令工作正常。

有没有办法cp不带./前缀的文件名?

linux bash command-line find string-manipulation

3
推荐指数
1
解决办法
648
查看次数

标签 统计

bash ×1

command-line ×1

find ×1

linux ×1

string-manipulation ×1