On 04/11/2010 08:56 PM, Rue U wrote:
The "cd" command/program doesnt work with paths stored in a variable.
If the variable contains the backslash.
Such as:
var=/media/New\ Folder\ Here/
/media/etc...
cd $var
bash: cd: /tmp/New: No such file or directory
/tmp/etc... ? Shouldn't be /media/etc...?
echo $var
/tmp/New Folder Here/
OKAY FAIR ENOUGH. NOT ESCAPED. Now let me add some escapes!
-----------------------------------------------------------------------------
var="/tmp/New\ Folder\ Here/"
cd $var
bash: cd: /tmp/New\: No such file or directory
It stops right at the first escape.
Is there a solution to this? Thanks
Try `cd "$var"'.
RR