Thanks, Chet!
From: Chet Ramey
To: John Wiersba ; "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 ch
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 n
From: jrw32...@yahoo.com
To: bug-bash@gnu.org,b...@packages.debian.org
Subject: OLDPWD unset when bash starts
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTY
Why does bash clear OLDPWD when a child script is started?
OLDPWD is exported and passed to any children, but bash apparently clears
OLDPWD whenever a child script is started:
$ cd /etc
$ cd
$ perl -e 'print "<$ENV{OLDPWD}>\n"'
$ ksh -c 'echo "<$OLDPWD>"'
$ bash -c 'echo "<$OLDPWD>"'
<>
$ un