shebang如何执行程序? [英] How does the shebang execute the program?

查看:96
本文介绍了shebang如何执行程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得自己是个菜鸟,但是我想知道程序( Ex :#!/usr/bin/env python)中的shebang是如何执行的?

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?

我知道该文件是由./filename运行的,但是如何使用正确的执行程序来运行它呢?

I know that the file is run by ./filename, but how does it run it with the right executor?

与使用python命令运行它是否相同?如果是这样,shebang如何将其重定向到命令?

Would it be the same as running it with the python command? If so, how does the shebang redirect it to the command?

推荐答案

瑟吉奥(Sergio)回答:

Sergio Answered:

shebang行指定正确的执行者".就是这样找到它的(通过程序加载器).

这篇关于shebang如何执行程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆