为什么我们在 Bash 脚本中使用 #!/bin/bash?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52034231/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 17:00:44 来源:igfitidea点击:
Why we use #!/bin/bash in Bash script?
提问by Suraj Kumar Singh
What is the significant of using #!/bin/bashin the starting of bash script? Can we write a bash script without #!/bin/bash?
在 bash 脚本的开头使用#!/bin/bash 有什么意义?我们可以在没有#!/bin/bash 的情况下编写 bash 脚本吗?
回答by MrTux
This line is called shebang. It's a ?magic‘ line telling the program loader (kernel) how to execute a script on unixoid systems.
这条线叫做shebang。这是一个“魔法”行,告诉程序加载器(内核)如何在 unixoid 系统上执行脚本。