问题
I feel like a total noob asking this question, but I'm wondering, how does the shebang in a program (Ex: #!/usr/bin/env python
) execute it?
I know that the file is run by ./filename
, but how does it run it with the right executor?
Would it be the same as running it with the python
command? If so, how does the shebang redirect it to the command?
回答1:
Sergio Answered:
The shebang line specifies the right "executor". That's how it is found (by the program loader).
来源:https://stackoverflow.com/questions/39547588/how-does-the-shebang-execute-the-program