This always used to drive me nuts when different people used different varients of flag (-r
Or -R
) for achieving same result.
is there some good reason why recursive cp takes -R whereas recursive scp takes -r?
It was until I decided I had to get more information on why and headed out to POSIX manual.
If the -r option was specified, the behavior is implementation-defined.
If the -R option was specified, the following steps shall be taken:
The dest_file shall be created with the same file type as source_file.
If source_file is a file of type FIFO, the file permission bits shall be the same as those of source_file, modified by the file creation mask of the user if the -p option was not specified. Otherwise, the permissions, owner ID, and group ID of dest_file are implementation-defined.
If this creation fails for any reason, cp shall write a diagnostic message to standard error, do nothing more with source_file, and go on to any remaining files.
If source_file is a file of type symbolic link, the pathname contained in dest_file shall be the same as the pathname contained in source_file.
If this fails for any reason, cp shall write a diagnostic message to standard error, do nothing more with source_file, and go on to any remaining files.
Since then, it is always -R
that I (and most of the people I know) use — after all who likes the unknown behind “behaviour defined by implementation”?