Sha-bang

The sha-bang , represented by #! , is a heading of a file which indicates to the system that this file is a whole of orders for the interpreter indicated.

One finds also other denominations: shabang , she-bang , shebang , hash-bang

Technically, the characters #! is in fact a “number magic” ( magic number ), composed of two Octet S, a special marker which indicate a type of file, or an achievable script Shell (the order man magic gives more details on this topic).

Immediately after the sha-bang a way (example is: #! /bin/bash). It is the way towards the program which interprets the orders of this script, that it is a Shell, a Langage of script, a language of Programmation or a utility. One can make it follow options which he recognizes (for example - X for Shell to post the detail of its execution). Then, this interpreter of orders carries out the orders of script, while starting at the beginning (line 1), by being unaware of the comments.

Examples of sha-bang: #! /bin/sh - X #! /bin/bash #! /usr/bin/perl #! /usr/bin/tcl #! /bin/sed - F #! /usr/awk - F

The sha-bang is used in the textual files of scripts in the environments of the type Unix (Linux, BSD, GNU/Hurd, etc).

One can use the program env instead of an interpreter of orders to seek this one in the PATH (what prevents having to rewrite the first line of scripts if one must carry them on another machine for example): #! /usr/bin/env python … but the problem is that one is likely not to call the good version of the interpreter if several are present on the machine.

Random links:Final Fantasy IX | Allan Hunt | Adine Masson | Aphrodite (film) | Anton Dohrn | Orwellian