How do cope with a space when setting the $PATH I want to add the sublime lib to my path but it has a space in it. 

I have tried the obvious like you would navigate in the terminal (
e.g. /Applications/Sublime\ Text\ 2.app/Contents)

export PATH="/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl:$PATH"


But I still get the error 

/Applications/Sublime: No such file or directory


I could rename it but I am curious how to resolve it. I am using bash.
Use backslash or quotes, not both. You put the sequence backslash-space in the PATH value.

export PATH="/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl:$PATH"


or

export PATH=/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl:$PATH


Be sure not to wrap the line: it has to be spaces, not newlines.

Note that if you see an error like /Applications/Sublime: No such file or directory from the export PATH=… line, then you have a syntax error in that line, such as a space after the equal sign: the assignment doesn't try to look up the directory. If the error is at some later time, then it isn't due to the PATH value, or if so only very indirectly: it's perfectly ok for entries in $PATH not to exist, and a non-existent directory will not lead to an error message.