[NTLUG:Discuss] Symbolic link strangeness
Wayne Walker
wwalker at bybent.com
Sun Jun 11 08:16:18 CDT 2006
Leroy,
you are using the pwd built into your shell, probably bash. By default
it tells you "where you asked to go" not "where you are".
To see where you really are, use /bin/pwd or pwd -P.
The first uses the system program which won't lie to you. The second
uses the bash builtin pwd and tells it to not lie to you.
The third thing you can do is, at the command line, or better, in your
.bashrc file, "set -o physical" tells the bash builtin to not lie to
you.
Wayne
On Sat, Jun 10, 2006 at 11:30:33PM -0500, Leroy Tennison wrote:
> Trying to figure out kdm on CentOS 4.3. Found:
>
> cd /usr/share/config/kdm
> [leroy at linux-b kdm]$ pwd
> /usr/share/config/kdm
> [leroy at linux-b kdm]$ ll Xsession
> lrwxrwxrwx 1 root root 22 May 7 05:08 Xsession -> ../../X11/xdm/Xsession
> [leroy at linux-b kdm]$ cd ../../X11/xdm
> [leroy at linux-b xdm]$ pwd
> /etc/X11/xdm Hmmm, why am I not in
> /usr/share/X11/xdm?
>
> After a little puzzlement and research
>
> [leroy at linux-b xdm]$ cd /usr/share/config
> [leroy at linux-b config]$ ll kdm
> lrwxrwxrwx 1 root root 20 May 7 05:08 kdm -> ../../../etc/kde/kdm
>
> OK, now the puzzlement above makes sense, so I decide to do
>
> [leroy at linux-b config]$ cd kdm
> [leroy at linux-b kdm]$ pwd
> /usr/share/config/kdm
>
> Why is pwd showing me /usr/share/config/kdm when I'm really in /etc/kde/kdm?
>
> I know that's where I am because (I had to su because the directory was
> Read Only to all but root)
>
> [leroy at linux-b kdm]$ su
> Password:
> [root at linux-b kdm]# cat > LeRoY
> Where am I really?
> Ctrl-D on an empty line put me back at the prompt.
> [root at linux-b kdm]# ll L*
> -rw-r--r-- 1 root root 19 Jun 10 23:19 LeRoY
> [root at linux-b kdm]# exit
> exit
> [leroy at linux-b kdm]$ cd /etc/kde/kdm
> [leroy at linux-b kdm]$ ll L*
> -rw-r--r-- 1 root root 19 Jun 10 23:19 LeRoY
> [leroy at linux-b kdm]$ cat LeRoY
> Where am I really?
> [leroy at linux-b kdm]$ pwd
> /etc/kde/kdm
>
> What disturbs me about this is I can't trust the reply of pwd when a
> symbolic link is a part of a path. Is there another command I can use
> to tell where I REALLY am instead of where I appear to be?
> /usr/share/config/kdm doesn't really exist as a unique directory.
>
> _______________________________________________
> http://ntlug.pmichaud.com/mailman/listinfo/discuss
--
Wayne Walker
www.unwiredbuyer.com - when you just can't be by the computer
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
More information about the Discuss
mailing list