如何使用变量- $BASE
在CD中。我尝试了以下操作,但出现错误
$ cd ~/z/repo_1_ruby_193/
23:23:57 durrantm Castle2012 /home/durrantm/z/repo_1_ruby_193
$ BASE="~/z"
23:24:03 durrantm Castle2012 /home/durrantm/z/repo_1_ruby_193
$ cd $BASE/repo_1_ruby_193
-bash: cd: ~/z/repo_1_ruby_193: No such file or directory
23:24:25 durrantm Castle2012 /home/durrantm/z/repo_1_ruby_193
BASE=~/"quoted name"
只要不加~
引号,就可以正常工作。