Linux下-bash: Permission denied 或者 sudo: command not found 错误

有时候执行一个脚本或者运行一个可执行文件时,如执行脚本./foo.sh,会报错-bash: ./foo.sh: Permission denied,你会再试sudo ./foo.sh,发现继续报错sudo: foo.sh: command not found,这时候可能是因为该文件没有执行权限,可以通过ls -l foo.sh查看文件信息,如果确实没有,可以为文件增加执行权限

chmod +x foo.sh

这个时候就可以运行了。

参考Command not found when using sudo

相关推荐