sh文件执行报错

来源:互联网 发布:手机淘宝店铺装修 编辑:程序博客网 时间:2024/05/29 10:08

执行时提示权限不够,处理方法:使用chmod命令为该文件增加x权限

[root@CentOS sh]# ./helloworld.sh
-bash: ./helloworld.sh: 权限不够

执行时提示:没有那个文件或目录

[root@CentOS sh]# ./helloworld.sh
-bash: ./helloworld.sh: bin/sh: bad interpreter: 没有那个文件或目录

解决方法:sh文件内容开头必须是如下内容,注意bin前必须有“/”

#!/bin/sh