方法一:切换到shell脚本所在的目录(此时,称为工作目录)执行shell脚本:
cd /data/shell
./hello.sh
方法二:以绝对路径的方式去执行bash shell脚本:
/data/shell/hello.sh
方法三:直接使用bash 或sh 来执行bash shell脚本:
cd /data/shell
bash hello.sh
或者
cd /data/shell
sh hello.sh

解决linux的-bash: ./xx.sh: Permission denied
解决方法:
chmod 777 xx.sh
Linux chmod +755和chmod +777 各是什么意思呢?
755 代表用户对该文件拥有读,写,执行的权限,同组其他人员拥有执行和读的权限,没有写的权限,其他用户的权限和同组人员权限一样。
777代表,user,group ,others ,都有读写和可执行权限。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐