LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 03-24-2011, 06:05 PM   #1
jim_d
Member
 
Registered: May 2010
Posts: 42

Rep: Reputation: 0
trailing slash / in path syntax


If you see this path by itself, no context or explanation:
/ab1/ab2/ab3

...you know that /ab1 is a directory off the root /, and that ab2 is a subdirectory; but ab3 could be either a subdirectory or a file, correct?

Contrast with:
/ab1/ab2/ab3/

...then the trailing slash means that ab3 must be a directory?

If my above understanding is correct: Is it considered good practice to avoid ambiguity and always add the trailing slash after the last directory in a path?
 
Old 03-24-2011, 06:17 PM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Yes. The trailing slash will designate a directory.
 
1 members found this post helpful.
Old 03-24-2011, 06:25 PM   #3
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
@jim_d: You are correct on all points. I do agree that explicitly using the trailing slash eliminates ambiguity and should probably be considered good practice.
 
  


Reply

Tags
directory, path, slash


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Add trailing slash adrianc.grigoras Linux - Software 1 05-13-2009 07:26 AM
Apache2 trailing slash issues! mephitic Linux - Software 2 02-04-2005 04:24 AM
Apache trailing slash boondock_saint Linux - General 9 07-07-2004 04:31 PM
Apache trailing slash puzzler tantric Linux - Software 4 04-11-2004 05:18 PM
Apache2 Trailing Slash Problem xwastedmindx Linux - Software 6 10-20-2003 09:59 PM


All times are GMT -5. The time now is 11:00 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration