summaryrefslogtreecommitdiff
path: root/tests/ln
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 /tests/ln
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 'tests/ln')
-rwxr-xr-xtests/ln/relative.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ln/relative.sh b/tests/ln/relative.sh
index 818da8392..8d4f1e7e0 100755
--- a/tests/ln/relative.sh
+++ b/tests/ln/relative.sh
@@ -34,4 +34,15 @@ ln -s dir1/dir2/f existing_link
ln -srf here existing_link
test $(readlink existing_link) = 'here' || fail=1
+# Demonstrate resolved symlinks used to generate relative links
+# so here, 'web/latest' will not be linked to the intermediate 'latest' link.
+# You'd probably want to use realpath(1) in conjunction
+# with ln(1) without --relative to give greater control.
+ln -s release1 alpha
+ln -s release2 beta
+ln -s beta latest
+mkdir web
+ln -sr latest web/latest
+test $(readlink web/latest) = '../release2' || fail=1
+
Exit $fail