> -----Original Message----- > From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On > Behalf Of Ulrik S. Kofod > Sent: Friday, May 13, 2005 2:25 AM > To: centos at centos.org > Subject: [CentOS] When ".." isn't the same? (not a problem > > 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. Isolved> 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 $ pwdand> when it is > one level up from the link target. > 3) if there is an alternativ way to point to the parent directory. >I believe I understand what you're describing and it's been a long time since I've had this 'issue' but if I remember correctly, it's a function of your shell, which I believe is going to be bash. It tries to be intelligent about its symlink handling. It remembers the cd path you used to get to that symlink and 'cd ..' sends you back the same way you got in. It basically treats symlinks as real directories, not pointers. This can be very useful but it can also be annoying. I'll bet if you use tcsh, which uses a more literal interpretation of the file-structure, it would work as you expect. I wasn't ever interested in it enough to see if it could be disabled in bash. -- Marc
Maciej Zenczykowski
2005-May-13 14:19 UTC
[CentOS] When ".." isn't the same? (not a problem
> I believe I understand what you're describing and it's been a long time > since I've had this 'issue' but if I remember correctly, it's a function > of your shell, which I believe is going to be bash. It tries to be > intelligent about its symlink handling. It remembers the cd path you > used to get to that symlink and 'cd ..' sends you back the same way you > got in. It basically treats symlinks as real directories, not pointers. > This can be very useful but it can also be annoying. I'll bet if you use > tcsh, which uses a more literal interpretation of the file-structure, it > would work as you expect. I wasn't ever interested in it enough to see > if it could be disabled in bash.I believe the proper option is -P as in "set -P" in bash to disable this feature (IMHO very useful). Cheers, MaZe.
> -----Original Message----- > From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On > Behalf Of Maciej Zenczykowski > Sent: Friday, May 13, 2005 9:19 AM > To: CentOS mailing list > Subject: RE: [CentOS] When ".." isn't the same? (not a problem > > > I believe I understand what you're describing and it's been a longtime> > since I've had this 'issue' but if I remember correctly, it's afunction> > of your shell, which I believe is going to be bash. It tries to be > > intelligent about its symlink handling. It remembers the cd path you > > used to get to that symlink and 'cd ..' sends you back the same wayyou> > got in. It basically treats symlinks as real directories, notpointers.> > This can be very useful but it can also be annoying. I'll bet if youuse> > tcsh, which uses a more literal interpretation of thefile-structure, it> > would work as you expect. I wasn't ever interested in it enough tosee> > if it could be disabled in bash. > > I believe the proper option is -P as in "set -P" in bash to disablethis> feature (IMHO very useful).Indeed -- -P If set, the shell does not follow symbolic links when executing commands such as cd that change the current working directory. It uses the physical directory structure instead. By default, bash follows the logical chain of directories when performing commands which change the current directory. -- Marc