Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #11909
| From | John Wiersba <jrw32982@yahoo.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | OLDPWD unset when bash starts |
| Date | 2015-11-18 19:44 +0000 |
| Message-ID | <mailman.179.1447877287.31583.bug-bash@gnu.org> (permalink) |
| References | <453853448.7488208.1447875868401.JavaMail.yahoo.ref@mail.yahoo.com> |
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"'
</etc>
$ ksh -c 'echo "<$OLDPWD>"'
</etc>
$ bash -c 'echo "<$OLDPWD>"'
<>
$ uname -a
Linux myserver 2.6.32-504.8.1.el6.x86_64 #1 SMP Fri Dec 19 12:09:25 EST 2014
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
$ bash --version | head -1
GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
Can bash be fixed to preserve the value of any OLDPWD in its initial environment, like it does with PWD?
Thanks!
-- John Wiersba
Back to gnu.bash.bug | Previous | Next | Find similar
OLDPWD unset when bash starts John Wiersba <jrw32982@yahoo.com> - 2015-11-18 19:44 +0000
csiph-web