Mail Archives: cygwin/2001/08/08/10:34:20
--------------5E75E1ED722479F799CDCF20
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
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.
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.
Rich
Peter Feldbaumer wrote:
> Hi!
>
> I'm new to this mailing-list, so please excuse if I ask questions that
> aren't that new to you.
> I tried to search the archives concerning pwd-problems, and found that there
> have already been some discussions concerning the paths pwd (or /bin/pwd) is
> returning.
>
> I'm having the problem, that pwd always returns the path where you typed in
> your last command.
> This breaks a few makefiles if they are located in subdirectories, since
> they use "$(shell pwd)" to get their "TOPDIR".
> And since pwd doesn't return the path the makefile is in, but rather the
> path you typed "make -C subdir" in, they don't get their "TOPDIR" right.
>
> First I thought that this was a problem only concerning "make", but some
> tests prooved that this seems to be a general problem with "pwd".
>
> If you have a short shell-script
>
> #!/bin/sh
> pwd
>
> saved as /tmp/print_pwd, and then go to your root dir and type
>
> tmp/print_pwd
>
> the output of print_pwd will be
>
> /
>
> and not
>
> /tmp
>
> as I would expect.
>
> Please correct me, but I don't think that this is the expected behaviour of
> "pwd".
> Right now I'm using the snaptshot of Aug.7th 2001 on Win98, but this "bug"
> (feature?) was already present in the snapshots before.
>
> If I'm wrong about this, please could you point out ANY way that I can get
> pwd to print the "current" directory, since I tried already numerous
> versions (cd tmp && pwd ....) and they all deliver the same result!
>
> Best regards,
> Peter Feldbaumer
> --
> FeldTech.com - Software Engineering & System Solutions
> Goestingerstraße 72, 8051 Graz, Austria
> Tel.: +43/316/584530 - Fax.: +43/316/584930
> http://www.feldtech.com - mailto:feldbaumer AT feldtech DOT com
>
> --
> 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/
--------------5E75E1ED722479F799CDCF20
Content-Type: text/x-vcard; charset=us-ascii;
name="rramos.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Richard Ramos
Content-Disposition: attachment;
filename="rramos.vcf"
begin:vcard
n:Ramos;Richard
tel;work:732-380-2846
x-mozilla-html:FALSE
org:Coree Networks
adr:;;56 Park Road;Tinton Falls;NJ;07724;
version:2.1
email;internet:rramos AT coreenetworks DOT com
title:Software Engineer
fn:Richard Ramos
end:vcard
--------------5E75E1ED722479F799CDCF20
Content-Type: text/plain; charset=us-ascii
--
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/
--------------5E75E1ED722479F799CDCF20--
- Raw text -