summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-04-03 18:33:43 +0100
committerPádraig Brady <P@draigBrady.com>2013-04-04 02:46:52 +0100
commit34023817cb0225b50779a546a58e057e5e920d2c (patch)
tree485a69eb66ae56f1d61c8eae93270c5ea51be7b5 /doc
parente52293aa7fcf283758f97bc9bcc945707ccbce0a (diff)
downloadcoreutils-34023817cb0225b50779a546a58e057e5e920d2c.tar.xz
doc: add details on ln --relative symlink resolution
* doc/coreutils.texi (ln invocation): Describe how symlinks are resolved with --relative, and give an example showing the greater control available through realpath(1). * tests/ln/relative.sh: Add a test to demonstrate full symlink resolution, in a case where it might not be wanted.
Diffstat (limited to 'doc')
-rw-r--r--doc/coreutils.texi18
1 files changed, 17 insertions, 1 deletions
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index dfa9b1c21..4cfe4c50c 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -9798,8 +9798,24 @@ ln -srv /a/file /tmp
'/tmp/file' -> '../a/file'
@end smallexample
+Relative symbolic links are generated based on their canonicalized
+containing directory, and canonicalized targets. I.E. all symbolic
+links in these file names will be resolved.
@xref{realpath invocation}, which gives greater control
-over relative file name generation.
+over relative file name generation, as demonstrated in the following example:
+
+@example
+@verbatim
+ln--relative() {
+ test "$1" = --no-symlinks && { nosym=$1; shift; }
+ target="$1";
+ test -d "$2" && link="$2/." || link="$2"
+ rtarget="$(realpath $nosym -m "$target" \
+ --relative-to "$(dirname "$link")")"
+ ln -s -v "$rtarget" "$link"
+}
+@end verbatim
+@end example
@item -s
@itemx --symbolic