LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 06-16-2009, 12:52 PM   #1
BeacoN
Member
 
Registered: Nov 2008
Distribution: Linux Mint
Posts: 56

Rep: Reputation: 17
dar n spaces in directory name


Hey all, how goes it?

I'm using Cygwin on a windows box, kind of like putting a Ferrari engine in a Smart Car. Anyways, I'm trying to set a variable to go to this directory

/cygdrive/c/Documents and Settings/Default User/.settings

I can do it with the command...

cd /cygdrive/c/Documents\ and\ Settings/Default\ User/.settings

but I'd like to know how to set the full path to a variable and use the variable with cd. I tried using double backslashes and eval, but to no avail. I am working around with making a function with the cd command in it, but always want to know more than one way to do something. Ideas?
 
Old 06-16-2009, 02:21 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello BeacoN

What's the language you are using on Cygwin and is the command parsed more than once?

Best

Charles
 
Old 06-16-2009, 03:29 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by BeacoN View Post
Hey all, how goes it?

I'm using Cygwin on a windows box, kind of like putting a Ferrari engine in a Smart Car. Anyways, I'm trying to set a variable to go to this directory

/cygdrive/c/Documents and Settings/Default User/.settings

I can do it with the command...

cd /cygdrive/c/Documents\ and\ Settings/Default\ User/.settings

but I'd like to know how to set the full path to a variable and use the variable with cd. I tried using double backslashes and eval, but to no avail. I am working around with making a function with the cd command in it, but always want to know more than one way to do something. Ideas?
You should be able to just go
variable="/cygdrive/c/Documents and Settings/Default User/.settings"
and
cd "$variable"


Cheers,
Tink
 
Old 06-16-2009, 10:31 PM   #4
BeacoN
Member
 
Registered: Nov 2008
Distribution: Linux Mint
Posts: 56

Original Poster
Rep: Reputation: 17
Charles,

It's just a simple BASH shell I was trying to get to a directory with.

Tink,

Many thanks, don't know why I didn't try that. I guess that's what I get for being forced into a Windows environment in work-my BASH gets rusty. Your suggestion worked fine-I forgot to use the double quotes in both places to reserve spaces.

-Brian
 
  


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
LXer: Disk ARchive (Backup and Restore) using dar and kdar(dar Frontend) LXer Syndicated Linux News 0 01-12-2007 06:54 PM
smbclient spaces in directory names? darkleaf Linux - Networking 2 11-23-2004 03:25 PM
backup from directory with spaces dennis_89 Linux - Networking 7 06-21-2004 11:14 PM
directory-names with spaces... Schmurff Linux - Newbie 2 03-07-2004 12:06 PM
cd to a directory with spaces? GT_Onizuka Linux - Newbie 3 08-28-2003 06:00 PM


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