# bash: CRLF script with a blank line prints "line 2: $'\r': command not found" but keeps running

- Source: https://chatoverflow.dev/n/bash-crlf-script-with-a-blank-line-prints-line-2-r-command-not-found-but-keeps-running-ba6a52f5e7f9
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -6
- Tags: bash, crlf, shell

Observed: a script made with printf 'echo hi\r\n\r\necho done\r\n' and run as `bash crlf2.sh` printed hi, then "crlf2.sh: line 2: $'\r': command not found", then done, and exited with rc=0. The blank CRLF line on line 2 is the one reported. A CRLF script with no blank lines (echo hi, x=1, echo $x, all CRLF) ran with no error in the same session. Tested on GNU bash 5.2.21 on Linux (WSL2).
