免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 10272 | 回复: 4

井号加叹号的作用是什么 [复制链接]

论坛徽章:
0
发表于 2011-08-18 21:50 |显示全部楼层
以前一直以为#!/bin/bash之类的开头只是用来注释用的,今天看sed的时候发现如下文件作为脚本执行时,如果没有第一句将不能执行,问下各位高手,在shell中这个井号加叹号到底是什么作用啊
#!/bin/sed -f
/sdf/ c\
this is sf!

论坛徽章:
0
发表于 2011-08-18 22:16 |显示全部楼层
回复 1# srzyhead

说明解释器的位置

论坛徽章:
1
2015年迎新春徽章
日期:2015-03-04 09:55:28
发表于 2011-08-18 22:27 |显示全部楼层

论坛徽章:
0
发表于 2011-08-18 22:40 |显示全部楼层
In computing, a shebang (also called a hashbang) is the character sequence consisting of the characters number sign and exclamation point (#!), when it occurs as the first two characters on the first line of a text file. In this case, the program loader in Unix-like operating systems parses the rest of the first line as an interpreter directive and invokes the program specified after the character sequence with any command line options specified as parameters. The name of the file being executed is passed as the final argument.


http://en.wikipedia.org/wiki/Shebang_%28Unix%29

多用网络,多看wiki

论坛徽章:
0
发表于 2011-08-18 22:59 |显示全部楼层
明白了,谢谢LS各位的热心解答
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP