How does Linux handle multiple consecutive path separators (/home////username///file)?
152
votes
6
answers
30933
views
I'm working on a python script that passes file locations to an scp subprocess. That's all fine, but I'm in a situation where I may end up concatenating a path with a filename such that there's a double '
/
in the path. I know that bash doesn't care if you have multiple file separators, but I'm wondering how exactly that is rectified. Is it bash that strips extra /
s or does it really not matter ever?
I ask because it will save me several lines of code to check for extra /
s while concatenating. I know it's not a big deal, but I'm curious as well. I have a bash script that has the line cd //usr
(instead of cd /usr
), which seems to imply there might be a significance to using multiple /
s in a path
Asked by Falmarri
(13517 rep)
Sep 12, 2010, 08:59 AM
Last activity: Oct 5, 2020, 07:43 AM
Last activity: Oct 5, 2020, 07:43 AM