pwd vs $PWD, bash, cygwin vs Linux

Eric Blake ericblake@comcast.net
Wed May 4 03:34:00 GMT 2005


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



More information about the Cygwin mailing list