Suppose I have a directory foo
, another directory foo/bar
, and finally a file foo/bar/foobar
.
Here's the quirk:
- If I am in the directory
foo
and typeln -s bar/foobar .
it creates a working symlink. - If I am in the directory
foo/bar
and typeln -s foobar ../
it creates a symlink to the symlink itself, which makes it broken.
I suppose it is somehow related to absolute path vs relative path since ln -s "pwd"/specavg_Pr1_ID15_20160201.fits "pwd"/../
(not actually "
but `
, but it has a rendering issue) works perfectly.
What I don't understand is, if it were cp
or other commands it'd do as what I've expected. But were it not, it would've made huge disasters. What is the difference here, and is there a good habit to ensure my commands reference files correctly? (without referencing with full path all the time...)