Reputation: 715
What's the proper way to do this?
$ export SUBLPKG=~/"Library/Application Support/Sublime Text 2/Packages"
$ cd $SUBLPKG
-bash: cd: /Users/$ME/Library/Application: No such file or directory
$ export SUBLPKG=~/"Library/Application\ Support/Sublime\ Text\ 2/Packages"
$echo $SUBLPKG
/Users/$ME/Library/Application\ Support/Sublime\ Text\ 2/Packages
$ cd $SUBLPKG
-bash: cd: /Users/$ME/Library/Application\: No such file or directory
Upvotes: 2
Views: 4075
Reputation: 123678
The proper way is to quote the variable while expanding else word splitting would happen on whitespaces:
export SUBLPKG=~/"Library/Application Support/Sublime Text 2/Packages"
cd "$SUBLPKG"
You might also want to refer to Word Splitting in the manual.
Also refer to Word Splitting here.
Upvotes: 7