Linux - Script (Shebang)


Script in Linux:

Syntax (Shebang)

#!/usr/bin/env perl

where the first line called the shebang define the interpreter to run.

  • the # is the command
  • the exclamation mark (“!”) is affectionately called “bang”
  • /bin/bash the path to the interpreter.
  • env start a new script without environment variable

The interpreter is not limited to bash. Scripts can be written in an other language such as:

  • Python,
  • Perl
  • Ruby, PHP, etc, etc.

The shebang is a kernel required syntax (not mandatory from the shell prespective)

Powered by ComboStrap