linux - When executing a shell script, it prompts "No such file or directory"?
習慣沉默
習慣沉默 2017-05-16 13:32:13
0
5
1142

1. Transfer the SHELL file written under Windows to Linux for execution, and an error message will appear.
2. Error message: bad interpreter: There is no such file or directory.

習慣沉默
習慣沉默

reply all(5)
習慣沉默

There are differences in line breaks and so on in different systems. It should be caused by different invisible characters. Find a conversion tool, or most editors can do this, and just convert some characters.

刘奇

Screenshots
Errors and codes

Ty80

Does your file path contain Chinese characters? If it contains Chinese characters and your shell script is gbk encoded, the file or directory will not be found, because Chinese file and directory names under Linux are UTF-8 encoded.

洪涛

You can consider using the following command to convert the carriage return under Windows to the carriage return under Linux, and try running it again

# dos2unix xxx.sh
阿神

It always feels like there is no execution permission problem,
Try itchmod 755 xxx.sh

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template