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

Time:2021-9-26

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

Recommended Today

Supervisor

Supervisor [note] Supervisor – H view supervisor command help Supervisorctl – H view supervisorctl command help Supervisorctl help view the action command of supervisorctl Supervisorctl help any action to view the use of this action 1. Introduction Supervisor is a process control system. Generally speaking, it can monitor your process. If the process exits abnormally, […]