You can confirm that $VMROOT contains the proper string by echo $VMROOT. If you put the path in quotes, you wouldn't need the escape (\) on the space. You say that Linux accepts a space in a path name /if/ it's escaped, so maybe you need to double up on the escape. That is, $VMROOT is
/var/lib/vmware/Virtual\ Machines/ at the time it's fed to "cd". That may mean ...Virtual\\ Machines... or even more backslashes in the string. Try up to 4 before giving up and changing the directory to ...Virtual_Machines... John Mort wrote: > In a bash script, the following doesn't work: > > VMROOT=/var/lib/vmware/Virtual\ Machines/ > cd $VMROOT > > > But this does: > cd /var/lib/vmware/Virtual\ Machines/ > > I've tried putting the variable value into single and double quotes but that > approach doesn't seem to be working. Any pointers on how to make it work? > > _______________________________________________ Mid-Hudson Valley Linux Users Group http://mhvlug.org http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug Upcoming Meetings (6pm - 8pm) MHVLS Auditorium Sep 3 - Porkchop - The Areas of My Expertise Oct 1 - Ubikeys Oct 4 - Linux Fest Nov 5 - Releasing Open Source Software Dec 3 - TBD
