`bash: ./backup.sh: Permission denied` right after cloning the repo.
BeginnerTroubleshootingTroubleshooting: syntax, parsing and interpreter errors
Answer
Likely causes → The execute bit is not set, either locally or in Git (the file was committed with mode 100644).
Diagnose →
ls -l backup.sh # -rw-r--r--
git ls-files -s backup.sh # 100644 = not executable in Git
Fix → chmod +x backup.sh locally, and record it in Git: git update-index --chmod=+x backup.sh && git commit -m "make backup.sh executable". As a workaround, bash backup.sh runs it without the bit.
Prevent → Commit scripts with mode 100755, and add a CI check: git ls-files -s '*.sh' | awk '$1 != "100755" {print "not executable:", $4; bad=1} END {exit bad}'.
More on Troubleshooting: syntax, parsing and interpreter errors
`./deploy.sh` fails with `bash: ./deploy.sh: /bin/bash^M: bad interpreter: No such file or directory` (or, on Bash 5.2, `cannot execute: required file not found`).Beginner`deploy.sh: line 14: syntax error near unexpected token `fi'`Beginner`install.sh: line 87: syntax error: unexpected end of file`Beginner`warning: here-document at line 12 delimited by end-of-file (wanted `EOF')` and the rest of the script never runs.Beginner`bash: [: missing `]'`BeginnerA script prints `/bin/sh: 1: [[: not found` and then continues as if the test were false.Beginner