Skip to content
Advertisement

All possible exit codes for cp

Looking at the man pages for cp, I only found that the command exits with 0 when copy succeeds with no error, and with a number greater than 0 on any error. However I couldn’t find any detailed description on specific exit codes mapped to specific cases. Is there such a description anywhere, is it even standardized, or each Unix/Linux distribution has its own exit code set for different scenarios?

Advertisement

Answer

Here is how cp from coreutils-8.21 exits:

exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);

There’s nothing else than 0 or 1.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement