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.
Add
to the first lineTry 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.
DOS file format?