Running `bash script.sh` prints `script.sh: line 2: $'\r': command not found` on every blank line.
BeginnerTroubleshootingTroubleshooting: syntax, parsing and interpreter errors
Answer
Likely causes → CRLF line endings again. Running through bash avoids the shebang error, but every blank line now contains just \r, which Bash tries to run as a command. Other lines may fail subtly (cd /srv/app\r → No such file or directory).
Diagnose → cat -A script.sh | head shows ^M$ at line ends.
Fix → sed -i 's/\r$//' script.sh.
Prevent → .gitattributes with *.sh text eol=lf; an .editorconfig with end_of_line = lf.
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`warning: here-document at line 12 delimited by end-of-file (wanted `EOF')` and the rest of the script never runs.Beginner`bash: [: missing `]'`Beginner