关于shell:shell脚本中-cd-到带空格的文件夹的大坑

6次阅读

共计 302 个字符,预计需要花费 1 分钟才能阅读完成。

记录一下明天的大坑,xcode 工程里有一个文件叫 target support files 的目录. 没错你没看错, 就是带空格的目录. 咋之前听网上说是这样写、那样写, 无非就是这两种
1. 给门路加 ””

dirPath="YourProject/target support files"
cd $dirPath

2. 再加本义 \

dirPath="YourProject/target\ support\ files"
cd $dirPath

以上两种办法在 mac 上都行不通,会报 YourProject/target not found, 上面才是正确的写法

cd YourProject/target\ support\ files

你没看错,就是不要双引号

正文完
 0