| Start |
|---|
| Env shebang To execute a script file with the The The script must have execution permission. The shebang is ignored when a |
| Direct shebang To execute a script file with the The The script must have execution permission. The shebang is ignored when a |
| Other shebangs There are two kinds of programs the kernel knows of. A binary program is identified by it's ELF (ExtenableLoadableFormat) header, which is usually produced by a compiler. The second one are scripts of any kind. If a file starts in the very first line with the sequence #! then the next string has to be a pathname of an interpreter. If the kernel reads this line, it calls the interpreter named by this pathname and gives all of the following words in this line as arguments to the interpreter. If there is no file named "something" or "wrong": bash tries to execute its argument "something wrong" which doesn't exist. The name of the script file is added too. To see this clearly use an echo shebang: Some programs like awk use this technique to run longer scripts residing in a disk file. SyntaxRemarksA common mistake is to try to execute Windows end-line formatted And is obliviously not found but can be hard to figure out. |
Read Article
https://develop.horje.com/learn/1434/reference