[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange behavior after removing folder
From: |
Chet Ramey |
Subject: |
Re: Strange behavior after removing folder |
Date: |
Mon, 15 Jul 2024 10:34:27 -0400 |
User-agent: |
Mozilla Thunderbird |
On 7/14/24 2:39 PM, Батунин Сергей wrote:
Bash Version: 5.0
Patch Level: 17
Release Status: release
Description:
I entered the following commands:
cd
mkdir a
cd a
rmdir $PWD
cd .
This succeeds, because you can always cd to `.' (`chdir(".")' works) even
if you can't reach the current directory by any pathname.
Then my $PWD became /a/./
The shell attempts to canonicalize the pathname supplied as an argument
by appending it to $PWD and trying to resolve the pathname, removing `.'
and `..' and collapsing multiple slashes to one. This fails, because it
verifies that the canonicalization results in a valid directory name,
and it doesn't. Then it tries to obtain the physical pathname of the
current directory, using the getcwd() algorithm, which also fails. The
fallback is the uncanonicalized full pathname.
Also, i entered
cd ./////.
Now my $PWD is ~/a/././////.
For the same reason.
Then I pressed ctrl+shift+t , and now in new window my $PWD=/
Is it correct behavior?
This doesn't have anything to do with the shell. It's probably the default
your terminal emulator uses when chdir to $PWD from the current tab fails.
--
``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/
OpenPGP_signature.asc
Description: OpenPGP digital signature