shebang

 

In computer programming, shebang refers to the hash/number sign (#) followed by an exclamation point (!) that begins most scripts, ie., #! . It is also sometimes called sha-bang or hashbang.

In Linux and other Unix-like systems, when a script with a shebang as the first line is run, the program loader takes the rest of the shebang line to be the path to the interpreter program for the script. This interpreter is launched and passed the path of the original script which it then runs. Because most interpreted languages use a hash sign to denote the beginning of a comment, the interpreter ignores the shebang line and proceeds to run the rest of the script.

For example, a Python script may begin with a shebang line like:

This, however, suffers from portability issues since the location of the python executable may vary from system to system. A more robust shebang line for Python scripts is:

 

« Back to Glossary Index
 Posted by at 2:20 pm

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)