What is the use/meaning of "#!/bin/sh" in shell scripting? Please let me know whether it is considered in the script or not as it is commented.
#!/bin/sh
The sha-bang ( #!) [1] at the head of a script tells your system that this file is a set of commands to be fed to the command interpreter indicated. The #! is actually a two-byte [2] magic number, a special marker that designates a file type, or in this case an executable shell script (type man magic for more details on this fascinating topic). Immediately following the sha-bang is a path name. This is the path to the program that interprets the commands in the script, whether it be a shell, a programming language, or a utility. This command interpreter then executes the commands in the script, starting at the top (the line following the sha-bang line), and ignoring comments. [3]
Source: http://tldp.org/LDP/abs/html/sha-bang.html#MAGNUMREF
2.1m questions
2.1m answers
60 comments
57.0k users