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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to