Pages

Wednesday, May 3, 2017

What is Shebang

Starting a Script With #!. It is called a shebang or a "bang" line.

It is nothing but the absolute path to the Bash interpreter.

It consists of a number sign and an exclamation point character (#!), followed by the full path to the interpreter such as /bin/bash.

All scripts under Linux execute using the interpreter specified on a first line. Almost all bash scripts often begin with #!/bin/bash (assuming that Bash has been installed in /bin)

This ensures that Bash will be used to interpret the script, even if it is executed under another.

The shebang was introduced by Dennis Ritchie between Version 7 Unix and 8 at Bell Laboratories. It was then also added to the BSD line at Berkeley [4].


In computer science, an interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without previously compiling them into a machine language program.

No comments:

Post a Comment