[CentOS] When “..” isn’t the same? (not a problem

Fri May 13 07:25:21 UTC 2005
Ulrik S. Kofod <usk at cybersite.dk>

I don’t understand why ".." isn’t working the same way for "ls" and "cd" when inside
a symbolic link. The reason I ask is that I made a link to a directory with some
scripts that saves output in "../output.txt" and I could not find the output until I
found that ".." isn’t the directory you see when you do a $pwd. I solved the problem
by making a directory and then make a link to each script in there.

I would just like to know:
1) if there is a good reason to this behaviour.
2) if there is a rule, so you know when ".." is level up from $ pwd and when it is
one level up from the link target.
3) if there is an alternativ way to point to the parent directory.

Personally I can't see why you would ever need ".." to be one level up from the link
target.

Example:
$ ln -s /home link_to_home; cd link_to_home

$ ls ..
bin   dev  home    lib   misc  


$ cd ..;ls
link_to_home


Have a nice weekend
Ulrik







-- 
This message has been scanned for viruses and
dangerous content by OpenProtect(http://www.openprotect.com), and is
believed to be clean.