This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin symlink? bug


On Sun, Feb 09, 2003 at 09:30:17PM -0000, Elfyn McBratney wrote:

hi you,

> > BASH keeps an internal idea of the current working directory. In the 
> > face of symbolic links, this internal record of the current working 
> > directory may not be identical to that computed by the "pwd" programs 
> > traversal-to-root algorithm.
> > 
> > I use this instead of BASH's built-in pwd command:
> > 
> > wd() {
> >      WD="$(pwd)"
> >      WDP="$(/bin/pwd)"
> >      if [ "$WD" != "$WDP" ]; then
> >          echo "bash: $WD"$'\n'"real: $WDP"
> >      else
> >          echo "$WD"
> >      fi
> > }
> > 
> > I use this one if I want to see the Windows form of the current working 
> > directory, too:
> > 
> > awd() {
> >      WD="$(pwd)"
> >      WDP="$(/bin/pwd)"
> >      if [ "$WD" != "$WDP" ]; then
> >          echo "bash: $WD"$'\n'"cyg:  $WDP"
> >      else
> >          echo "cyg:  $WD"
> >      fi
> >      echo "win:  $(cygpath -w -a "$(pwd)")"
> >      echo "mix:  $(cygpath -m -a "$(pwd)")"
> > }
> > 
> > Randall Schulz
> 
> Thanks Randall, That's something new for my sandbox ;-)
> 
> Ando sorry..meant to send to the list not a direct thing :::::::-)

sorry for making some noise here, but the pwd bash-builtin does have a
switch. start it with "pwd -P" and it will traverse symlinks and
printout the real current working directory.

pwd: pwd [-PL]
    Print the current working directory.  With the -P option, pwd prints
    the physical directory, without any symbolic links; the -L option
    makes pwd follow symbolic links.

HTH

 - regards, turrican

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]