Thanks, Chet!

 
      From: Chet Ramey <chet.ra...@case.edu>
 To: John Wiersba <jrw32...@yahoo.com>; "bug-bash@gnu.org" <bug-bash@gnu.org> 
Cc: chet.ra...@case.edu
 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    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/


   

Reply via email to