The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ksh: difference between $* and $@ JamesByars Shell Programming and Scripting 1 12-30-2007 07:08 AM
Difference between $* and $@ saneeshjose Shell Programming and Scripting 1 01-19-2006 05:03 AM
Difference between C and C++ hytechpro High Level Programming 2 11-29-2005 06:48 PM
difference rajashekaran UNIX for Advanced & Expert Users 1 04-22-2002 10:59 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-22-2007
deckard's Avatar
Registered User
 

Join Date: Jul 2002
Location: Ohio
Posts: 110
What's the Difference Between / and //?

Many times over the years, I've noticed that if I accidentally type 'cd //', my bash prompt will display that I am in // instead of /. If I do an ls command, it looks just like I'm in /. So this morning I decided to try and do 'cd ///' all the way up to a full 'cd //////'. None of those attempts did the same thing as //. Knowing that nearly everything in *nix seems to have a real purpose, I suspect // really means something slightly different from /. Are there any long time *nix users who might know the history? I've only been using *nix for ten years and haven't a clue.
Reply With Quote
Forum Sponsor
  #2  
Old 05-22-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,618
/ is a separator between components of a pathname. Consider /usr/bin/ksh. The leading slash tells you that this is a absolute pathname so you start at root and look for "usr". Then you look in "usr" for "bin". The path known as / is a little special. The leading slash says it's an absolute path so we start at root. And then we're done. With a path like /usr/bin//ksh you have superfluous separators. A path like that is not guaranteed to work so you shouldn't do it. But superfluous separators are easy to ignore and this is commonly done. The path // is a special case of a path with superfluous separators.


Code:
$ cd //
$ cd ///
$ cd //////
$ cd /////////
$ /usr/bin/pwd
/
$
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0