On 25Aug2015 08:34, Paolo Galtieri <pgaltieri(a)gmail.com> wrote:
On 08/24/2015 02:19 PM, Cameron Simpson wrote:
>On 24Aug2015 13:55, Paolo Galtieri <pgaltieri(a)gmail.com> wrote:
>Symlinks are strings resolved with respect to the directory in which
>the symlink exists.
>
>So the example above "Test/afile" => "Test/afile2" makes a
symlink
>_in_ the directory "Test" named "afile2" pointing at
"Test/afile".
>Therefore it tries to access the path "Test/Test/afile", which fails
>as one might expect.
>
>When making a symbolic link it needs to either be (a) an absolute
>path or (b) relative WRT to the directory hodling the link. For the
>latter, the reliable way is to cd to the directory and make in from
>inside. That way command line filename completion prodcues working
>results.
[...]
thank you for your reply. As it turns out the ln command
ln -s Test/afile Test/afile1
does create the link.
Of course it does. It is just a string. You can put pretty much anything you
like in there.
The problem as you noted is the ls command.
No, the problem is that the string in the symlink is _wrong_. "ls" is behaving
correctly. What you have put in the symlink is wrong, because it does not
correctly point at the target file.
You can either manually construct a correct symlink (suggestions above) or if
you have GNU ln (true on Fedora) use the -r option to have it figure this out
for you.
Cheers,
Cameron Simpson <cs(a)zip.com.au>