What does the line “#!/bin/sh” mean in a UNIX shell script?

It’s called a shebang, and tells the parent shell which interpreter should be used to execute the script. #!/bin/sh <——— bourne shell compatible script #!/usr/bin/perl <– perl script #!/usr/bin/php <— php script #!/bin/false <—— do-nothing script, because false returns immediately anyways. Most scripting languages tend to interpret a line starting with # as comment and … Read more

How does the #! shebang work?

Recommended reading: The UNIX FAQ: Why do some scripts start with #! … ? The #! magic, details about the shebang/hash-bang mechanism on various Unix flavours Wikipedia: Shebang The unix kernel’s program loader is responsible for doing this. When exec() is called, it asks the kernel to load the program from the file at its … Read more

How to make python scripts executable on Windows? [duplicate]

This sums it up better than I can say it: http://docs.python.org/faq/windows.html More specifically, check out the 2nd section titled “How do I make Python scripts executable?” On Windows, the standard Python installer already associates the .py extension with a file type (Python.File) and gives that file type an open command that runs the interpreter (D:\Program … Read more