Re: mkdir this "." directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, Dec 29, 2009 at 10:21:01AM -0800, John R Pierce wrote:

> for instance, say  /home/pierce is a symlink to /home2/pierce  and I'm 
> in /home and go cd pierce, then go cd ..      in *some* unix systems, 
> that cd .. takes me back to home, in others takes me to /home2

It's actually shell dependent, not Unix platform dependent.  Some shells
(eg bash, ksh) perform parsing of the "cd" parameter and so will appear
to back-out of symlinks.  Other (typically older) shells just naively
do a chdir("..") call, which will take you to the real parent directory.

Sometimes both behaviours are useful, so I've created a function "up"

  up()
  {
    cd "`/bin/pwd`/.."
  }

So...

  /home/sweh$ cd public_html
  /home/sweh/public_html$ cd ..
  /home/sweh$ cd public_html
  /home/sweh/public_html$ up
  /autofs/publish$ ls -l /home/sweh/public_html
  lrwxrwxrwx 1 sweh sweh 20 Jun  8  2008 /home/sweh/public_html -> /autofs/publish/public_html/

Symlinks combined with automounters... fun :-)

-- 

rgds
Stephen
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux