how do you create an usable path variable with a space in it?

Jerome Fong jfong@successmetricsinc.com
Thu Mar 8 21:08:00 GMT 2007


I've been trying to create a variable for my Java home 
(/cygdrive/c/Program\ Files/Java/jdk1.5.0_10).  However, no matter how I 
seem to create it, I am not able to use it.  I read some threads that 
suggest creating a symlink without the space in the path name, but is 
that my only option?

What is weird is, I have set "echo on", the path it uses to find 
java.exe is correct and if I cut and paste it to the command line, it 
works.   Here is what I did:

# create variable

export JAVA_HOME='/cygdrive/c/Program\ Files/Java/jdk1.5.0_10'

echo $JAVA_HOME
/cygdrive/c/Program\ Files/Java/jdk1.5.0_10

"$JAVA_HOME"/bin/java.exe -cp "$CLASSPATH" ....
./test.sh: line 32: /cygdrive/c/Program\ 
Files/Java/jdk1.5.0_10/bin/java.exe: No such file or directory


However, when I copy the command and run it interactive, the command 
works.  I seem to be getting the backslash in the right spot, and it 
does work interactively.  What else should I do?  Should I be adding 
more quotes or something?  Any idea what I am doing wrong?

thanks,

Jerome


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list