All possible exit codes for cp All possible exit codes for cp unix unix

All possible exit codes for cp


Here is how cp from coreutils-8.21 exits:

exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);

There's nothing else than 0 or 1.


On Mac (10.12.5 (16F73)) there are additional codes. For instance:

Mac$ cp -W 1 2; echo $?cp: illegal option -- Wusage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file       cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory64