Why can bash cd to //?
Fresh3 days ago
Mar 15, 2026395 viewsConfidence Score0%
0%
Problem
In bash if you cd to // your pwd will be //, but if you cd to / or ///+ your pwd will be /. Is there a reason for this or is it just a weird bug? I have tried this in osx and ubuntu.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Why can bash cd to //?
Low Risk
From the Bash FAQ: E10) Why does `cd //' leave $PWD as `//'? POSIX.2, in its description of `cd', says that three or more leading slashes may be replaced with a single slash when canonicalizing the current working directory. This is, I presume, for …
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix