[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "cd -" is not the same as "cd $OLDPWD"
From: |
Chet Ramey |
Subject: |
Re: "cd -" is not the same as "cd $OLDPWD" |
Date: |
Thu, 6 Jul 2023 11:14:32 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 |
On 7/1/23 4:02 PM, Dustin Boyd wrote:
Bash Version: 5.2
Patch Level: 15
Release Status: release
Description:
Setting OLDPWD to anything other than an absolute path causes
`cd -` to behave incorrectly, defaulting to ./$OLDPWD instead of
being equivalent to `cd $OLDPWD` per POSIX requirements.
Thanks for the report. The upcoming issue of POSIX says that if you set
OLDPWD to something, all bets are off and the shell can do what it wants,
but it's reasonable to handle this case.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/