Python Forum
Is the #! (shebang) line obsolete?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is the #! (shebang) line obsolete?
#2
newbieAuggie2019 Wrote:1) What does the #! (shebang) line exactly do?
The shebang line is not related to the python language. It is a Unix system feature that tells the unix shell which command interpreter to use to execute the file containing the shebang line. So if a file spam.py starts with #!/usr/bin/python3 it is an indication to the OS that this program must be run by the executable program /usr/bin/python3.

Linux and MacOS inherited this feature from Unix, and Windows adopted this feature more recently because as the years go by, Microsoft has realized that it needs to include an ever increasing number of Linux features to keep its market share.

newbieAuggie2019 Wrote:2) Is the #! (shebang) line obsolete?
The shebang line is by no means obsolete, only you don't need it to run python programs if you always tell the computer which interpreter to use.
Reply


Messages In This Thread
RE: Is the #! (shebang) line obsolete? - by Gribouillis - Oct-29-2019, 09:37 PM
RE: Is the #! (shebang) line obsolete? - by nilamo - Oct-29-2019, 09:39 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020