I\'m using Bash on macOS 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 director
After struggling with the same problem, I tried two different solutions that works:
"") with your variables.Easiest way just double quotes your variables as pointed in previous answer:
cd "$yourPathWithBlankSpace"
eval.According to this answer Unix command to escape spaces you can strip blank space then make use of eval, like this:
yourPathEscaped=$(printf %q "$yourPathWithBlankSpace")
eval cd $yourPathEscaped