How do I use "cd" to access a directory with a space, for example "XML 5.1 Final Fields" in a bash script
I tried cd XML 5.1 Final Fields
But it's giving the No such file or directory
error.
This is the script:
#! /bin/bash
xmlfolder="XML/ \/5.1/ \/Final/ \/Fields"
xmlpath="/home/george/Desktop/m5u/test/$xmlfolder"
cd $xmlpath
ls /home/george/Desktop/m5u/test/
XML 5.1 Final Fields
~/Desktop/m5u/test$ ll
drwxr-xr-x 9 george george 4096 Feb 18 12:44 XML 5.1 Final Fields
this is the error I get when I run the script
line 5: cd: /home/george/Desktop/m5u/test/XML\: No such file or directory
cd george
and then hit tab it autocompletes the command if it finds suitable candidates. Then hit enter to fire up the command. – YpsilonKah Feb 18 '16 at 11:56stat george
+TAB+ENTER to see how the file is actually named. It might have some space or other stuff at the end. – kos Feb 18 '16 at 11:58george ulahnnan linux
orXML[...]
? – kos Feb 18 '16 at 12:03