【发布时间】:2021-04-24 22:22:51
【问题描述】:
我正在尝试将文件复制到同一目录但带有前缀。我正在使用 xargs 来做到这一点。注意:我不能使用cd,因为它会破坏我管道中的构建。
这就是我所拥有的
root@gotoadmins-OU:~# ls
snap test
root@gotoadmins-OU:~# ls test/
me.war
root@gotoadmins-OU:~# ls test | xargs -I {} cp {} latest-{} test/
cp: cannot stat 'me.war': No such file or directory
cp: cannot stat 'latest-me.war': No such file or directory
【问题讨论】:
-
嗯,确实没有
me.war(但有test/me.war),也没有latest-me.war。你期待什么? -
I can't use cd as it will break build in my pipeline.请研究子shell。