A request for cp flag

Ian Smith smithi at nimnet.asn.au
Tue Oct 18 16:22:36 UTC 2016


In freebsd-questions Digest, Vol 646, Issue 2, Message: 12
On Mon, 17 Oct 2016 19:38:41 +0100 Steve O'Hara-Smith <steve at sohara.org> wrote:
 > On Mon, 17 Oct 2016 15:59:10 +0100
 > Matthew Seaman <matthew at FreeBSD.org> wrote:
 > 
 > > You're not going to get anyone to change the behaviour of a core command
 > > like cp(1) I'm afraid.  For all that you dislike the behaviour when
 > > copying a directory path that ends in '/' there will be many, many more
 > > people that have written scripts that depend on that exact behaviour and
 > > will be exceedingly peeved if those scripts stop working.
 > 
 > 	Adding a -r flag wouldn't break anything at least until POSIX adds
 > one that does something else and then there'd be a decision to make, for
 > that reason I doubt anyone would entertain a new single letter option to cp.

Not to pick on you in particular, Steve, but it seems nobody's noticed 
that FreeBSD cp(1) already supports an -r flag, albeit with deprecation.

COMPATIBILITY
     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
     implementations of -r differ as they copy special files as normal files
     while recreating a hierarchy.

cheers, Ian


More information about the freebsd-questions mailing list