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]

Re: pwd-problem


On Wed, Aug 08, 2001 at 10:35:10AM -0400, Richard Ramos wrote:
>Let me take this opportunity to describe some pwd-related behavior that
>I thought was unexpected.  Maybe we can hash out the whole "pwd" question.
>
>My not-so-informed opinion is that the behavior you see is what I would
>have expected since the command would have executed in you current
>directory.

pwd prints the current working directory.  If you cd to /, pwd will
print /.  I really don't understand how anyone could consider this
to be a bug.

>I put together a  script to illustrate the unexpected behavior I see:
>
>$cat testscr
>#! /bin/sh
>
>echo \$PWD=$PWD
>echo cd ..
>cd ..; echo pwd produces: `pwd`
>echo \$PWD = $PWD
>
>The output of the script is as follows:
>
>$ tstscr
>$PWD=/home/rramos
>cd ..
>pwd produces: /home
>$PWD = /home/rramos
>
>The pwd command seems to produce the result I would have expected
>(the directory changes according to the script) but the PWD variable stays
>fixed at the directory where I ran the script from.  I thought the PWD
>variable should have followed along.

The PWD variable is not used by ash.  If you want PWD to change use bash.

cgf

--
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]