How to create a symlink to another symlink without following target symlink but keeping relative path between the target symlink and created symlink ?
Using the following structure for test
├── dst
│
└── src
├── file.txt -> folder/file.txt
└── folder
└── file.txt
lrwxrwxrwx 1 user group 15 mars 16 20:05 src/file.txt -> folder/file.txt
Each time I try to create a symlink of src/file.txt
(itself a relative symlink of src/folder/file.txt
) in dst
folder, the resulting symlink is never like dst/file.txt -> ../src/file.txt
but always directly to the final target dst/file.txt -> ../src/folder/file.txt
ln -s -r [-T] 'src/file.txt' dst/file.txt
Only working without -r
and specifying myself the relative path
ln -s '../src/file.txt' dst/file.txt
I need to use this inside a for loop for many files recursively and I would like to keep a relative path between the symlinks but without following target symlink, just a relative symlink to another symlink.
Is it possible to use ln
with -r
relative option without following target symlink ?
Regards