`warning: here-document at line 12 delimited by end-of-file (wanted `EOF')` and the rest of the script never runs.
BeginnerTroubleshootingTroubleshooting: syntax, parsing and interpreter errors
Answer
Likely causes → Bash never found the closing EOF line, so it treated the rest of the file as here-doc content. The delimiter is indented with spaces, has trailing whitespace or a \r, or is spelled differently.
Diagnose →
grep -n 'EOF' script.sh | cat -A # look for " EOF$" or "EOF $" or "EOF^M$"
Fix → Put the delimiter alone at column 1 with nothing after it. If you want indentation, use <<-EOF and indent with tabs only.
Prevent → shfmt and ShellCheck flag broken here-docs; configure the editor to show whitespace.
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`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`bash: [: missing `]'`BeginnerA script prints `/bin/sh: 1: [[: not found` and then continues as if the test were false.Beginner