Using pipes seems weird to me. Anyway you should use the logical and
Bash operator:
$ cp /templates/apple /templates/used && cp /templates/apple /templates/inuse && rm /templates/apples
If the cp
commands fail, the rm
will not be executed.
Or, you can make a more elaborated command line using a for
loop and cmp
.