LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 01-05-2007, 12:47 PM   #1
ccee
LQ Newbie
 
Registered: Jan 2007
Posts: 5
Blog Entries: 1

Rep: Reputation: 0
directory names with spaces and variables


Hi All

For my first post

if I do:

DIR_NAME="directory with spaces"
mkdir $DIR_NAME

or

DIR_NAME='directory with spaces'
mkdir $DIR_NAME

or

DIR_NAME=directory\ with\ spaces
mkdir $DIR_NAME

None of these work

Can anyone shed some light on this ????

Thanks

Ccee
 
Old 01-05-2007, 12:50 PM   #2
Robert Diggs
Member
 
Registered: Dec 2006
Location: Florida
Distribution: The ones that come in magazines and books.
Posts: 136

Rep: Reputation: 15
Hey,

I would avoid spaces in filenames/directories at all costs. Linux really does NOT like it. Maybe use capitalization to split words up, but remember when you do that. LInux is case sensitive. Unlike Windows where you can type anything however you want.

Regards,

Brandon

edit: You can make directories with spaces (you can do it in the GUI) but you'll save yourself a headache with NO spaces.

2nd edit: try doing cd into the directory where you want to create the new directory and try mkdir dir_name

Last edited by Robert Diggs; 01-05-2007 at 12:57 PM.
 
Old 01-05-2007, 12:55 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,353
Blog Entries: 55

Rep: Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541Reputation: 3541
mkdir "$DIR_NAME", and welcome to LQ, hope you like it here.
 
  


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
how to get rid of " " spaces in file names in a directory lleb Linux - General 7 08-09-2006 04:08 PM
How to access directory names that contain spaces ? s_deepak_123 Programming 3 03-07-2006 03:28 AM
du or wc and file names with spaces bramadams Slackware 2 01-27-2005 11:43 AM
smbclient spaces in directory names? darkleaf Linux - Networking 2 11-23-2004 02:25 PM
directory-names with spaces... Schmurff Linux - Newbie 2 03-07-2004 11:06 AM


All times are GMT -5. The time now is 11:47 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