BASH Script to cd to directory with spaces in pathname
- by Rails Newbie
Argggg. I've been struggling with this stupid problem for days and I can't find an answer.
I'm using BASH on Mac OS X and I'd like to create a simple executable script file that would change to another directory when it's run. However, the path to that directory has spaces in it. How the heck do you do this? This is what I have...
Name of file: cdcode
File contents:
cd ~/My Code
Now granted, this isn't a long pathname, but my actual pathname is five directories deep and four of those directories have spaces in the path.
BTW, I've tried
cd "~/My Code"
and
cd "~/My\ Code"
and neither of these worked.
If you can help, THANKS! This is driving me crazy!!