LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 11-22-2012, 11:53 PM   #1
NeoNewbie
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Rep: Reputation: Disabled
rmdir double forwardslash?


Hey guys, as the name suggests, I'm VERY new to Linux.
I've been working with it through TestOut, and am planning on taking the Linux+ exam in a few weeks. As such, I've been taking some practice exams. I ran across this question from BrainDump, and I don't quite get it. The question is:

Bob accidentally created the subdirectory \bobsdir in his home directory. He tried using rmdir \bobsfile only to recieve the error message, "No such file or directory."Which of the following commands will remove the directory?

A: rmdir '~bob/\bobsdir'
B: rmdir "~bob/\bobsdir"
C: rmdir ~bob/\'bobsdir'
D: rmdir ~bob/\bobsdir (my answer choice)
E: rmdir ~bob/\\bobsdir (correct answer)

I'm not understanding why E is correct. Any explanation would be helpful, thanks!
 
Old 11-23-2012, 12:28 AM   #2
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,617

Rep: Reputation: 442Reputation: 442Reputation: 442Reputation: 442Reputation: 442
Quote:
I'm not understanding why E is correct. Any explanation would be helpful, thanks!
Because double backward slash '\\' is understood by unix/gnu shell as a simple backward slash character; whereas, if it is used as a single '\' it is not a simple character but an escape character.
 
1 members found this post helpful.
Old 11-23-2012, 12:44 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
In addition to malekmustaq's post, more info on escaping/quoting here: http://tldp.org/LDP/Bash-Beginners-G...ect_03_03.html
 
1 members found this post helpful.
Old 11-23-2012, 01:04 AM   #4
NeoNewbie
LQ Newbie
 
Registered: Nov 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you both very much, that was helpful!
 
Old 04-08-2014, 09:28 PM   #5
rolexkid
LQ Newbie
 
Registered: Apr 2014
Posts: 3

Rep: Reputation: Disabled
I tried this on Fedora 20 and it doesn't work.
 
Old 04-24-2014, 07:28 AM   #6
-Soufiane-
LQ Newbie
 
Registered: May 2013
Location: France
Posts: 14

Rep: Reputation: Disabled
Missing slash

Quote:
Originally Posted by rolexkid View Post
I tried this on Fedora 20 and it doesn't work.

That's because a Slash (/) is missing right after the tilde ~ character. The answer should be ~/bob/\\bobsdir which does even not show in the list any advise ???!!!!!
 
Old 04-24-2014, 08:53 AM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,654

Rep: Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255Reputation: 1255
To have the ~ appropriately reference by the shell it has to precede the username desired: ~bob/\\bobsdir.
 
Old 04-24-2014, 11:47 AM   #8
-Soufiane-
LQ Newbie
 
Registered: May 2013
Location: France
Posts: 14

Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by jpollard View Post
To have the ~ appropriately reference by the shell it has to precede the username desired: ~bob/\\bobsdir.
Thank you Jpollard for the feedback. Roger that and tested it successfully.
 
  


Reply


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
i deleted rmdir jzocco Linux - Newbie 13 04-12-2006 01:19 PM
Why a directory can not be able rmdir? backpacker Linux - Software 3 11-21-2005 07:07 AM
rmdir namit Linux - Software 2 10-23-2005 03:26 PM
rmdir Fatal_3rr0r Linux - General 3 06-23-2003 05:25 PM
rmdir or other command Cichlid Linux - General 2 08-28-2002 05:30 PM


All times are GMT -5. The time now is 09:53 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration