On 03/27/2014 02:24 PM, Colton Peltier wrote: > Hi, > > While working with some coworkers recently we noticed a strange inconsistency > between cp and scp, that caused us some confusion. For the cp tool a -r or -R > will do a recursive copy of directories, but for scp only -r will. The -R > flag for scp is gives illegal option. What is the reasoning behind this?
cp accepts the non standarized -r for historical reasons. It's synonymous with the POSIX standardized -R. Interestingly for rm, POSIX has standardized that -r is equiv to -R. FreeBSD cp treats -r a bit differently and has this to say in the man page: Historic versions of the cp utility had a -r option. This implementation supports that option, however, its behavior is different from historical FreeBSD behavior. Use of this option is strongly discouraged as the behavior is implementation-dependent. In FreeBSD, -r is a synonym for -RL and works the same unless modified by other flags. Historical imple- mentations of -r differ as they copy special files as normal files while recreating a hierarchy. scp only accepts -r as it's a separate util not standardized by POSIX. BTW the openssl utils options can be quite inconsistent and confusing: ssh -P22 # use privileged port, use protocol version 2 ssh -p22 # use port 22 scp -P22 # use port 22 Pádraig.
