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_HOSTTYPE='x86_64' -DCONF_OSTYPE='l$ uname output: Linux john-mint-mate-17 3.13.0-37-generic #64-Ubuntu SMP Mon Sep $ Machine Type: x86_64-pc-linux-gnu Bash Version: 4.3 Patch Level: 11 Release Status: release Description: 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: Can bash be fixed to preserve the value of any OLDPWD in its initial environment, like it does with PWD? This appears to happen on all 3.x and 4.x versions of bash. Repeat-By: $ cd /etc $ cd $ perl -e 'print "<$ENV{OLDPWD}>\n"' </etc> $ ksh -c 'echo "<$OLDPWD>"' </etc> $ bash -c 'echo "<$OLDPWD>"' <>