cp: Default to -P when -R is specified
POSIX only specifies the -H, -L, and -P options for use with -R, and the default is left to the implementation. Without -R, symlinks must be followed. Most implementations use -P as the default with -R, which makes sense to me as default behavior (the source and destination trees are the same). Since we use the same code for -R and without it, and we allow -H, -L, and -P without -R, set the default based on the presence of -R. Without it, use -L as before, as required by POSIX, and with it, use -P to match the behavior of other implementations.
This commit is contained in:
5
cp.1
5
cp.1
@@ -48,9 +48,12 @@ Dereference
|
||||
if it is a symbolic link.
|
||||
.It Fl L
|
||||
Dereference all symbolic links.
|
||||
This is the default.
|
||||
This is the default without
|
||||
.Fl R .
|
||||
.It Fl P
|
||||
Preserve symbolic links.
|
||||
This is the default with
|
||||
.Fl R .
|
||||
.It Fl R
|
||||
Traverse directories recursively. If this flag is not specified, directories
|
||||
are not copied.
|
||||
|
Reference in New Issue
Block a user