Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.
Khelil Sator edited this page Jul 18, 2016 · 2 revisions

Welcome to the python-for-network-enginners wiki!

shebang

In scripts, first line should specify the path to interpreter.
But on different servers Linux, Unix, or BSD this path could be different.
Why do some python scripts begin with #!/usr/bin/env python or #!/usr/bin/python?
#!/usr/bin/env python or #!/usr/bin/python plays a role if the script is executable.
The script calls the language's interpreter to run the code inside the script.
the shebang is the "guide" to find, in your example, python.
Using #!/usr/bin/env python instead of #!/usr/bin/python makes sure python (or any other language's interpreter) is found, in case it might not be in exactly the same location across different Linux- or Unix -like distributions.
Although #!/usr/bin/python will work on a default Ubuntu system, it is therefore good practice to use #!/usr/bin/env python instead.

Clone this wiki locally