Bash文件夹变量中的逃生空间
-
11-12-2019 - |
题
我正在尝试在bash中创建一个变量,以迅速访问某些文件夹,并将其保存到我的bash_profile脚本文件中。这就是脚本看起来像的方式
Documents=~/Documents
Apps=~/Library/Application\ Support/iPhone\ Simulator/5.1/Applications
.
运行脚本后,$文档变量工作和$应用程序没有。它讲述:
-bash: cd: /Users/myusername/Library/Application: No such file or directory
.
这是文件夹的路径:
/Users/myusername/Library/Application Support/iPhone Simulator/5.1/Applications
.
我应该如何逃避空间?我使用Vim和I键入“CD $ apps”。
解决方案
空间很好;这是你的命令是错误的。
cd "$Apps"
. 其他提示
您还可以引用字符串而不使用反斜杠字符: Apps='〜/ Library /应用程序支持/ iPhone Simulator / 5.1 /应用程序' CD“$ apps”
不隶属于 StackOverflow