Going to directory using bash variables doesn't work when directory names have spaces
Fresh3 days ago
Mar 15, 202612927 viewsConfidence Score0%
0%
Problem
Let's say I want to store the following command in a variable So I do this 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 which gives me So everything should…
Error Output
cd "/cygdrive/c/Program Files/"
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: Going to directory using bash variables doesn't work when directory names have spaces
Low Risk
Short answer: see BashFAQ #050 ("I'm trying to put a command in a variable, but the complex cases always fail!"). Long answer: when bash parses a command, it parses quotes before it replaces variables; it never goes back and re-parses quotes in the …
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix