Charlie était proche, vous voulez que les -L
, -H
ou -P
drapeaux avec le drapeau -R
(probablement -R -P
). Des drapeaux similaires existent pour chmod(1)
et chgrp(1)
. J'ai collé un extrait de la page de manuel ci-dessous.
Exemple:
$ touch x
$ ln -s x y
$ ls -l x y
-rw-r--r-- 1 mjc mjc 0 Mar 31 18:58 x
lrwxrwxrwx 1 mjc mjc 1 Mar 31 18:58 y -> x
$ cp -R -P y z
$ ls -l z
lrwxrwxrwx 1 mjc mjc 1 Mar 31 18:58 z -> x
$
Sinon, vieux goudron plaine se fera un plaisir de travailler avec des liens symboliques par défaut, même la version vénérable qui est livré avec Solaris:
tar -cf foo | (cd bar && tar -xf -)
(où foo est un lien symbolique ou un répertoire contenant des liens symboliques).
/usr/bin/cp -r | -R [-H | -L | -P] [[email protected]] source_dir... target
...
-H Takes actions based on the type and contents of the
file referenced by any symbolic link specified as a
source_file operand.
If the source_file operand is a symbolic link, then cp
copies the file referenced by the symbolic link for
the source_file operand. All other symbolic links
encountered during traversal of a file hierarchy are
preserved.
-L Takes actions based on the type and contents of the
file referenced by any symbolic link specified as a
source_file operand or any symbolic links encountered
during traversal of a file hierarchy.
Copies files referenced by symbolic links. Symbolic
links encountered during traversal of a file hierarchy
are not preserved.
-P Takes actions on any symbolic link specified as a
source_file operand or any symbolic link encountered
during traversal of a file hierarchy.
Copies symbolic links. Symbolic links encountered dur-
ing traversal of a file hierarchy are preserved.
Les liens symboliques Solaris sont un cauchemar – ojblass