How to deal with whitespaces in OS X along filepaths when certain UNIX programs dislike it
I am trying to include a command in a TeX file to a bibliography file that I am storing centrally.
However, when including the filepath, like
/Foldername with whitespace/ANOTHER folder name with whitespace/nowsinfldrname/bibo.bib
my Unix-based typesetting system complains. Is there a way to rectify that other than renaming my folders?
In bash, there are two main ways to have spaces in path names:
-
Backslash escape the spaces
/path/to/folder\ with\ spaces/
-
Wrap with quote marks
"/path/to/folder with spaces and $variable/"
'/path/to/folder with spaces and a literal $/'
Double quote marks expand shell variables. Single quote marks do not.
Escape the spaces with a backslash:
This\ has\ spaces
As a last resort there are symbolic links.
the link is expanded at a lower level so the application level quoting is skipped.
ln -s '/Foldername with whitespace/ANOTHER folder name with whitespace/nowsinfldrname' /tmp/