delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/09/18:14:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 10 Feb 2003 00:15:14 +0100
From: Mathias Gygax <mg AT trash DOT net>
To: cygwin <cygwin AT cygwin DOT com>
Subject: Re: cygwin symlink? bug
Message-ID: <20030209231513.GA10083@zeus.eniac.ch.eu.org>
Mail-Followup-To: cygwin <cygwin AT cygwin DOT com>
References: <000901c2d022$869cbe80$0200a8c0 AT ufo> <5 DOT 2 DOT 0 DOT 9 DOT 2 DOT 20030209080135 DOT 02d48f88 AT pop3 DOT cris DOT com> <037701c2d083$5c3ed4f0$6b7c86d9 AT webdev>
Mime-Version: 1.0
In-Reply-To: <037701c2d083$5c3ed4f0$6b7c86d9@webdev>
User-Agent: Mutt/1.5.3i

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019