IEEE Standards Interpretation for IEEE Std 1003.1™-2008 IEEE Standard for Information Technology- Portable Operating System Interface (POSIX®) Base Specifications, Issue 7
Copyright © 2010 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.
Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.
IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA
Interpretation Request #1
Topic: OLDPWD Clause: 4. Utilities
IEEE Std 1003.1-2008 says to set OLDPWD to PWD if "the PWD environment variable is changed" or if the PWD environment variable value is changed. Currently all the existing Posix shells don't compare OLDPWD and PWD values, thus the result of cd command might be that OLDPWD is set to current directory.
IEEE Std 1003.1-2008 clearly states that the OLDPWD environment variable must be set to the current working directory immediately prior to the call to cd as long as the cd command completes successfully, and conforming implementations must conform to this.
Rationale for Interpretation
When IEEE Std 1003.1-2008 requires that the PWD environment variable be set, that constitutes a change to the PWD environment variable even if the new value of PWD is the same as the old value of PWD.