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: Chet Ramey
Subject: Re: OLDPWD unset when bash starts
Date: Thu, 26 Nov 2015 12:41:12 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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