bug-bash
[Top][All Lists]
Advanced

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

Re: bug in cd


From: Chet Ramey
Subject: Re: bug in cd
Date: Fri, 14 Jul 2017 09:31:01 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 7/14/17 7:14 AM, Kae Verens wrote:
> I'm not even sure if cd is part of Bash?

It is. It's a regular shell builtin.

> anyway - if you type any of the following:
> cd / ; pwd
> cd /// ; pwd
> cd //// ; pwd
> 
> the CLI always reports
> /
> 
> but, if you do this:
> cd // ; pwd
> 
> then the CLI reports
> //

Posix requires this behavior:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cd.html#tag_20_14

step 8c.

Two leading slashes must be preserved, because // has implementation-
defined semantics. Any other number may be collapsed to one slash.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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