什么是使用#的区别!在/ usr /斌/包膜或#的家当!/斌/包膜? [英] What's the difference of using #!/usr/bin/env or #!/bin/env in shebang?

查看:131
本文介绍了什么是使用#的区别!在/ usr /斌/包膜或#的家当!/斌/包膜?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

会不会有什么区别,或者它只是一个个人的选择?

Will there be any difference or it's just a personal choice?

推荐答案

#<!间preTER> <&参数GT; 尝试运行<间preTER> <论证方式> 读取并运行该文件的其余部分。

#!<interpreter> <arguments> tries to run <interpreter> <arguments> to read and run the rest of the file.

所以#!的/ usr / bin中/ env的意味着必须有一个节目叫的/ usr / bin中/ env的;结果
#!/ bin中/ env的意味着必须有一个节目叫 /斌/ env的

So #!/usr/bin/env means that there must be a program called /usr/bin/env;
#!/bin/env means that there must be a program called /bin/env.

一些系统具有一个而不是其他

Some systems have one and not the other.

在我的经验,最有的/ usr / bin中/ env的,所以#!的/ usr / bin中/ env的是比较常见的。

In my experience, most have /usr/bin/env, so #!/usr/bin/env is more common.

Unix系统将尝试运行&LT;间preTER&GT; 使用的execve ,这是为什么呢必须是一个完整路径,#!ENV 不带路径将无法工作。

Unix systems will try to run <interpreter> using execve, which is why it must be a full path, and #!env without a path will not work.

这篇关于什么是使用#的区别!在/ usr /斌/包膜或#的家当!/斌/包膜?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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