If you're trying to run a Bash script and get a
Permission Denied error, it's probably because you don't have the rights to execute it.
Let's check that's true.
# Get the current file permissions. stat -f %A script.sh # 644
644, the user owner can read and write but not execute.1
Set the permissions to
755 to fix the issue.
chmod 755 script.sh