0

I am curious if there is a way to set a symlink that could follow the below example format:

$> /tmp/../home/usr1/dir/oldFile

Specifically I want to create a file in another folder, say:

$> /home/usr2/newFile

that when I try to access it will resolve to the path above using a symlink rather than the most direct path (i.e. this one):

$> /home/usr1/dir/oldFile
2
  • I haven't tried what --relative/-r would do in that case, I am afraid it would make the symlink relative but look for the simplest relative path.
    – phk
    Oct 16 '15 at 7:23
  • Your example is not that clear to me, I could have miss understood you, but I've tested it and it seems to do what you are looking for. Check my answer
    – lese
    Oct 16 '15 at 8:30
1

I've tried to do what I think you are looking for and it work without problems, for this I'm having doubts if this is what you asking:

I created a symlink (called it "the_symlink) that point to a file on my Desktop following a funny path:

ln -s /tmp/../home/phphil/Desktop/suzuki\ check\ list.ods /home/phphil/the_symlink

the destination path of the link is effectively the one setted. It's not modified by the system

ls -la /home/phphil/symlink
lrwxrwxrwx 1 root root 49 Oct 16 10:27 /home/phphil/symlink -> /tmp/../home/phphil/Desktop/suzuki check list.ods

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.