Table of Contents

How to write a Linux Script (Shebang)?

About

This page is about the creation of Script in Linux.

They

Syntax (Shebang)

#!/bin/bash 
or
#!/usr/bin/env perl

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

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

#!/usr/bin/env bash
#!/bin/csh
#!/bin/python
#!/bin/perl
#!/usr/bin/Rscript

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

Location

According to the FHS, the script may be located: