bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OLDPWD unset when bash starts


From: John Wiersba
Subject: Re: OLDPWD unset when bash starts
Date: Thu, 26 Nov 2015 19:02:33 +0000 (UTC)

Thanks, Chet!


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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]