[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SCP Recursive Flag
From: |
Pádraig Brady |
Subject: |
Re: SCP Recursive Flag |
Date: |
Thu, 27 Mar 2014 15:31:04 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
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.