Significance of the Shebang Line

adisharma

n00b
Joined
Apr 17, 2020
Messages
4
Hello Everyone, I am preparing for Unix interview and I want to know, In shell scripting what is the significance of the Shebang line? Can anyone explain this with some examples?
 

blackmomba

Gawd
Joined
Dec 5, 2018
Messages
536
Its the path to the interpreter that is to be used to run the script. Wikipedia has some good examples

Some typical shebang lines:
  • #!/bin/sh – Execute the file using the Bourne shell, or a compatible shell, assumed to be in the /bin directory
  • #!/bin/bash – Execute the file using the Bash shell
  • #!/usr/bin/env python3 – Execute with a Python interpreter, using the env program search path to find it
 
Top