[Top][All Lists]

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

OLDPWD unset when bash starts

From: John Wiersba
Subject: OLDPWD unset when bash starts
Date: Thu, 19 Nov 2015 14:49:38 +0000 (UTC)

From: address@hidden
To: address@hidden,address@hidden
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


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.

$ cd /etc
$ cd
$ perl -e 'print "<$ENV{OLDPWD}>\n"'
$ ksh -c 'echo "<$OLDPWD>"'
$ bash -c 'echo "<$OLDPWD>"'

reply via email to

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