在我看来,使用管道似乎很奇怪。无论如何,你应该使用逻辑推理 and Bash操作员:
and
$ cp /templates/apple /templates/used && cp /templates/apple /templates/inuse && rm /templates/apples
如果 cp 命令失败时 rm 不会被处决。
cp
rm
或者,可以使用 for 循环和 cmp .
for
cmp