Thanks, Chet!
From: Chet Ramey <[email protected]>
To: John Wiersba <[email protected]>; "[email protected]" <[email protected]>
Cc: [email protected]
Sent: Thursday, November 26, 2015 12:41 PM
Subject: Re: OLDPWD unset when bash starts
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 [email protected] http://cnswww.cns.cwru.edu/~chet/