delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/03/23:34:20

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
From: ericblake AT comcast DOT net (Eric Blake)
To: cygwin AT cygwin DOT com
Subject: Re: pwd vs $PWD, bash, cygwin vs Linux
Date: Wed, 04 May 2005 03:34:06 +0000
Message-Id: <050420050334.10743.427842AE000B7E3F000029F722058861720A050E040D0C079D0A@comcast.net>
X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0

> >I know that Cygwin != Linux, however is it a reasonable expectation
> >that under the same shells, the same behaviour should apply?
> 
> In this case, the operative observation is bash != ash.  PWD is a bash
> construct.  You would be much better off just using the gnu make
> "CURDIR" variable.  Changing PWD to CURDIR in your examples makes things
> work as you'd expect.

POSIX requires /bin/sh to keep $PWD accurate, but ash does not meet POSIX requirements (in this and a number of other instances).  PWD is not just for bash, it is for all compliant shells.  Unfortunately, all of the open-source compliant shells come with so much extra weight (read: interactive features that aren't used by shell scripts, but that consume memory and slow down forks) that none of them have been deemed acceptable for replacing ash as cygwin's /bin/sh.

Also, you can safely use /bin/pwd from coreutils to find out your real current directory, although it does not yet implement the POSIX-required -L vs. -P options.

--
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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