Shebang

Mohit Sethi
Appliedcode
Published in
1 min readJul 7, 2013

In computing, a shebang, when it occurs as the initial two characters on the initial line of a script, is the character sequence consisting of the characters number sign and exclamation mark (“#!”).

Syntax:-

The form of a shebang interpreter directive is as follows:

#! Interpreter [optional — arg]

The interpreter must usually be an absolute path to a program that is not itself a script. The optional — arg should either not be included or it should be a string that is meant to be a single argument

Some typical shebang lines:

Ø #!/bin/sh — Execute the file using sh, the Bourne shell, or a compatible shell

Ø #!/bin/csh –f — Execute the file using csh, the C shell

Ø #!/usr/bin/perl –T — Execute using Perl with the option for taint checks[‘feature which increase security by preventing malicious users from executing commands on a host computers.’]

Ø #!/usr/bin/php — Execute the file using the PHP command line interpreter.

Ø #!/usr/bin/python –O — Execute using Python with optimizations to code

Ø #!/usr/bin/ruby — Execute using Ruby

Another and more preferred way is:

#!/usr/bin/env python

--

--

Mohit Sethi
Appliedcode

OpenSource | DevSecOps | DataScience | Machine Learning | ChatBots | Robotic Process Automation(RPA) | Coffee lover | Codes for a better world | Opinions = Mine