Linux 执行.sh报错:bad interpreter: No such file or directory
ringa_lee
ringa_lee 2017-04-17 14:47:07
0
5
509
ringa_lee
ringa_lee

ringa_lee

reply all(5)
Ty80

Add

to the first line
#!/bin/sh

Try it. First make sure /bin/sh exists. From the error message, it seems that the path of the shell program is wrong

巴扎黑

1. First make sure the path is correct, cd to the current directory of the file;

2. Secondly, make sure that the content of the shell file is correct. How to determine the error message with incorrect content: You can correct the correct file content in the system, and then execute it to see what error is reported;

3. Finally, although you are sure that there is no problem with the file permissions, it is still recommended that you execute it as the root user.

左手右手慢动作

This error is not necessarily a problem with the file itself. It may be a problem with a certain line of commands in the script content. Generally, use the
bash -x filename.sh method to debug.

大家讲道理

This problem seems to be because you did not write Shebang, that is, the file header lacks #!/bin/bash
If there is no such line, you can use the file name to check the type of the sh file.

is text, and after adding this line, it is displayed as a script.

As for ll, the file name has an asterisk, which means that the file is executable. In fact, the name of the file itself does not have *, but it is included when ll is output.

Peter_Zhu

DOS file format?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!