Main Page | See live article | Alphabetical index

Shebang

In computing, a shebang is command that makes a Unix-like operating system execute the commands in a text file using an interpreter. A shebang consists of a sharp symbol and exclamation point character #! in the first two columns of the first line, followed by the program that will provide the interpretation.

The name shebang comes from the contraction of sharp bang, referring to the two characters. Unix jargon uses bang to refer to the exclamation point character.

Usage

A typical shebang line could be

  #! /bin/sh

This instructs the operating system to interpret the file with the program /bin/sh.

It is common for different variants of even the same operating system to have different locations for the interpreter. Thus, it is not uncommon to need to adjust the shebang line after copying a script from one computer to another.

External links