`./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`).
BeginnerTroubleshootingTroubleshooting: syntax, parsing and interpreter errors
Answer
Likely causes → The file has Windows CRLF line endings, so the kernel looks for an interpreter literally named bash\r. It was edited on Windows or committed with core.autocrlf=true.
Diagnose →
file deploy.sh # "... with CRLF line terminators"
head -1 deploy.sh | od -c # shows \r \n at the end
Fix → sed -i 's/\r$//' deploy.sh or dos2unix deploy.sh, then commit the fixed file.
Prevent → Add *.sh text eol=lf to .gitattributes, set the editor to LF for shell files, and run ShellCheck in CI (it reports SC1017 for literal carriage returns).
More on Troubleshooting: syntax, parsing and interpreter errors
`bash: ./backup.sh: Permission denied` right after cloning the repo.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