Solved

what does // mean in Linux path?

Posted on 2006-06-21
5
1,171 Views
Last Modified: 2008-01-09
Hi,

what does "mkdir /home/test/util//" do other than mkdir util/?

The complete command in Linux is:
mkdir -p /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util//
&& ln -sfn /home/jess/rg-4.1.7/rg/pkg/util/test_lang.c /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util//test_lang.c

Thank you in advance,
Jessica
0
Comment
Question by:sctccomm
  • 3
5 Comments
 
LVL 8

Expert Comment

by:Autogard
ID: 16953912
The extra slashes should not be a problem at all in Linux.  it will just treat it as just one slash.

e.g.

"mkdir ~/something2//////" just creates "something2"
0
 
LVL 8

Expert Comment

by:Autogard
ID: 16953941
Also, in certain protocols two forward slashes can mean a network location, but that doesn't apply in your example.
0
 
LVL 8

Assisted Solution

by:Autogard
Autogard earned 150 total points
ID: 16954009
So:

mkdir -p /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util//
&& ln -sfn /home/jess/rg-4.1.7/rg/pkg/util/test_lang.c /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util//test_lang.c

should be the same as:

mkdir -p /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util/
&& ln -sfn /home/jess/rg-4.1.7/rg/pkg/util/test_lang.c /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util/test_lang.c

or even:

mkdir -p /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util//////////
&& ln -sfn /home/jess/rg-4.1.7/rg/pkg/util/test_lang.c /home/jess/rg-4.1.7/rg/build.CENTAUR/pkg/include/util//////////////test_lang.c

for that matter.  Give it a try.
0
 
LVL 7

Assisted Solution

by:NetExpert
NetExpert earned 150 total points
ID: 16954066
It's the same thing, a double slashes // is considered the same as single / when use in dir path/name.
0
 
LVL 7

Accepted Solution

by:
aib_42 earned 200 total points
ID: 16954420
The double directory seperators are a common off-by-1 mistake. Shell scripts that take, say, the name of a directory name and do something with it often append a trailing seperator:
rm $1/file.ext
del %1\file.ext

But not always; some of them want it to be supplied in the argument:
rm $1file.ext
del %1file.ext

So the best practice for a user is to put a trailing slash anyway, since it will work in both cases (as superfluous seperators are simply ignored.)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now