A big hole in the shell script where CD goes to a folder with spaces


Record today’s big pit. There is a directory called target support files in the Xcode project. Yes, you are right. It is a directory with spaces. I heard on the Internet that it is written in this way and that way. It is nothing more than these two kinds
1. Add “” to the path

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

2. Add escape\

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

Neither of the above two methods works on the Mac. You will report yourproject / target not found. The following is the correct way to write it

cd YourProject/target\ support\ files

You’re right, just don’t use double quotes