How does the shebang execute the program?

帅比萌擦擦* 提交于 2019-12-11 04:34:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!