LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   trailing slash / in path syntax (https://www.linuxquestions.org/questions/linux-newbie-8/trailing-slash-in-path-syntax-870819/)

jim_d 03-24-2011 05:05 PM

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?

corp769 03-24-2011 05:17 PM

Yes. The trailing slash will designate a directory.

Telengard 03-24-2011 05:25 PM

@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.


All times are GMT -5. The time now is 07:03 PM.