LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-01-2014, 06:25 PM   #1
danimalz
Member
 
Registered: Jul 2005
Location: West Coast South, USA
Distribution: debian 3.1
Posts: 267

Rep: Reputation: 36
wierd, just curious


just messing around, i typed:

cd //

it appears i am in some directory //

if i 'ls' this directory it is the root directory

anyone know about this is it a bug?
 
Old 01-01-2014, 06:31 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Not a bug.

I do not recall where to find the refs at the moment, but in Unixland multiple /'s in paths are treated as a single / by the kernel/shell/filesystem.

So when you cd // it collapses those to cd / for filesystem use, but the environment variable that records the current directory remembers it as you typed it, //.

So you are in the // directory which is exactly the same as /.

Hope that made sense.

*** UPDATE ***

A quick search found this as part of the Single Unix Specification:

Quote:
3.266 Pathname

A character string that is used to identify a file. In the context of IEEE Std 1003.1-2001, a pathname consists of, at most, {PATH_MAX} bytes, including the terminating null byte. It has an optional beginning slash, followed by zero or more filenames separated by slashes. A pathname may optionally contain one or more trailing slashes. Multiple successive slashes are considered to be the same as one slash.
The important thing is that they are not an error, it is not a bug, they are legal, but the same as a single slash.

Last edited by astrogeek; 01-01-2014 at 06:41 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Curious safeen Linux - Certification 4 08-12-2012 04:12 PM
just curious whether this can be done or not nikhidet1 Programming 5 10-27-2011 10:13 AM
curious! newbi2linux Linux - Laptop and Netbook 3 01-12-2006 11:56 AM
just curious tiang_ono Linux - Newbie 2 06-16-2005 06:37 AM
Just curious? BajaNick General 3 08-03-2003 12:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 01:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration