Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11928

Re: OLDPWD unset when bash starts

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: OLDPWD unset when bash starts
Date 2015-11-26 12:41 -0500
Organization ITS, Case Western Reserve University
Message-ID <mailman.768.1448559682.31583.bug-bash@gnu.org> (permalink)
References <453853448.7488208.1447875868401.JavaMail.yahoo.ref@mail.yahoo.com> <453853448.7488208.1447875868401.JavaMail.yahoo@mail.yahoo.com>

Show all headers | View raw


On 11/18/15 2:44 PM, John Wiersba wrote:
> Why does bash clear OLDPWD when a child script is started?

Because a new shell does not have a `previous working directory'.  It's
supposed to be set by cd, and if you haven't executed cd, you don't have
one.

It seems reasonable to inherit OLDPWD if it names a directory, in the same
way that the shell inherits PWD if it names the current directory, so we'll
try that for the next bash version.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: OLDPWD unset when bash starts Chet Ramey <chet.ramey@case.edu> - 2015-11-26 12:41 -0500

csiph-web