执行shell脚本是,报错-bash: ./test: Permission denied

在liunx系统中运行自己编译的shell脚本test.sh时,报以下错误:

-bash: ./test: Permission denied

报错原因:没有对该脚本又执行权限。

解决方法:

chmod +x ./test.sh  #使脚本具有执行权限
chmod 777 test.sh       #或者

Linux chmod +755和chmod +777 各是什么意思呢?

755 代表用户对该文件拥有读,写,执行的权限,同组其他人员拥有执行和读的权限,没有写的权限,其他用户的权限和同组人员权限一样。 777代表,user,group ,others ,都有读写和可执行权限。

 

原文地址:https://www.cnblogs.com/buzheng/p/12739135.html