Going to directory using bash variables doesn't work when directory names have spaces
- by gsingh2011
Let's say I want to store the following command in a variable
cd "/cygdrive/c/Program Files/"
So I do this
dir="cd \"/cygdrive/c/Program Files/\""
That should store the command to navigate to the Program Files directory, so when I type $dir it takes me to that directory. To check that the quotations have been properly escaped, I type
echo…