在shell脚本的第一行中,必须写#!/bin/bash
2012-12-11 09:36
405 查看
在shell脚本的第一行中,必须写#!/bin/bash
如果是用其他shell,在修改相应的shell路行
#!/bin/sh
表示本脚本由/bin/路径的sh程序来解释....
跟命令行下~
#/bin/sh Scriptname效果相同
如果不写也成,那就用你登陆的那个shell来解释执行. 可以不写,但应该有良好的编程习惯
“在很多情况中,如果没有设置好这一行,那么该程序很可能会无法执行,因为系统可能无法判断该程序需要使用什么shell来执行”
-------鸟哥
所以,shell脚本第一行不写这一条语句,能不能执行就看人品
如果是用其他shell,在修改相应的shell路行
#!/bin/sh
表示本脚本由/bin/路径的sh程序来解释....
跟命令行下~
#/bin/sh Scriptname效果相同
如果不写也成,那就用你登陆的那个shell来解释执行. 可以不写,但应该有良好的编程习惯
“在很多情况中,如果没有设置好这一行,那么该程序很可能会无法执行,因为系统可能无法判断该程序需要使用什么shell来执行”
-------鸟哥
所以,shell脚本第一行不写这一条语句,能不能执行就看人品
相关文章推荐
- 在shell脚本的第一行中,必须写#!/bin/bash
- Shell脚本第一行:#!/bin/bash的含义
- shell脚本第一行:#!/bin/bash的含义
- 笔记:Shell脚本文件报错:-bash: ./xxx.sh: /bin/bash^M: bad interpreter: No such file or directory
- shell脚本报错:-bash: xxx: /bin/sh^M: bad interpreter: No such file or directory
- shell脚本异常“bash: ./rebuild.sh: /bin/sh^M: bad interpreter: No such file or directory”
- shell脚本报错 -bash: ./mysql.sh: /bin/bash^M: bad interpreter: No such file or directory
- shell脚本报错:-bash: xxx: /bin/bash^M: bad interpreter: No such file or directory
- shell脚本文件 line 1: #!/bin/bash 没有那个文件或目录
- Shell脚本bash: ./t.sh:/bin/bash^M:损坏的解释器: 没有那个文件或目录
- Windows下记事本编辑的Shell脚本放到Linux下执行出错,格式问题(/bin/bash^M: bad interpreter: 没有那个文件或目录)
- shell脚本执行后出现错误提示" /bin/bash^M: bad interpreter: No such file or dire"的解决办法
- shell脚本报错问题: -bash: ./test.sh: /bin/sh^M: bad interpreter: No such file or directory
- shell脚本报错:-bash: xxx: /bin/sh^M: bad interpreter: No such file or directory --引用自http://blog.csdn.net/xiaaiwu/article/details/49126777
- Shell脚本报错:-bash: ./switch.sh: /bin/bash^M: bad interpreter: No such file or directory
- Shell脚本bash: ./t.sh:/bin/bash^M:损坏的解释器: 没有那个文件或目录
- shell脚本执行错误:#!/bin/bash: No such file or directory
- 运行shell脚本,错误bash: ./temp.sh: /bin/bash^M: bad interpreter: No such file or directory
- shell脚本报错:-bash: xxx: /bin/sh^M: bad interpreter: No such file or directory
- 关于shell脚本里面的的#!/bin/bash解释