shell腳本中 cd 到帶空格的文件夾的大坑

記錄一下今天的大坑,xcode工程裏有一個文件叫target support files的目錄.沒錯你沒看錯,就是帶空格的目錄.咋以前聽網上說是這樣寫、那樣寫,無非就是這兩種
1.給路徑加""xcode

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

2.再加轉義\code

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

以上兩種方法在mac上都行不通,會報YourProject/target not found,下面纔是正確的寫法get

cd YourProject/target\ support\ files

你沒看錯,就是不要雙引號file

相關文章
相關標籤/搜索