什么是pferred猛砸家当了$ P $? [英] What is the preferred Bash shebang?

查看:135
本文介绍了什么是pferred猛砸家当了$ P $?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何家当客观上比其他大多数用途?

Is there any Bash shebang objectively better than the others for most uses?


  • #!的/ usr / bin中/ env的庆典

  • #!/斌/庆典

  • #!/ bin / sh的

  • #/ bin / sh的 -


我依稀记得很久以前听说加一个破折号到底prevents有人传递一个命令脚本,却找不到上任何细节。

I vaguely recall a long time ago hearing that adding a dash to the end prevents someone passing a command to your script, but can’t find any details on that.

推荐答案

您应该使用 #!的/ usr / bin中/ env的庆典 作为便携:在不同的* nixes把庆典在不同的地方,并使用的/ usr / bin中/ env的是运行一个解决办法的第一个庆典上找到的 PATH 。和 SH 不是庆典

You should use #!/usr/bin/env bash for portability: different *nixes put bash in different places, and using /usr/bin/env is a workaround to run the first bash found on the PATH. And sh is not bash.

这篇关于什么是pferred猛砸家当了$ P $?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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