LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   dar n spaces in directory name (https://www.linuxquestions.org/questions/linux-newbie-8/dar-n-spaces-in-directory-name-733393/)

BeacoN 06-16-2009 11:52 AM

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?

catkin 06-16-2009 01:21 PM

Hello BeacoN :)

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

Best

Charles

Tinkster 06-16-2009 02:29 PM

Quote:

Originally Posted by BeacoN (Post 3576104)
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

BeacoN 06-16-2009 09:31 PM

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


All times are GMT -5. The time now is 02:08 AM.