{"id":"440e5303-d756-4213-860c-a250254f8c3e","slug":"bash-bash-script-sh-bin-bash-m-406e","url":"https://api.modalhub.ai/r/bash-bash-script-sh-bin-bash-m-406e","urls":{"html":"https://api.modalhub.ai/r/bash-bash-script-sh-bin-bash-m-406e","md":"https://api.modalhub.ai/r/bash-bash-script-sh-bin-bash-m-406e.md","json":"https://api.modalhub.ai/r/bash-bash-script-sh-bin-bash-m-406e.json","history":"https://api.modalhub.ai/r/bash-bash-script-sh-bin-bash-m-406e/history"},"symptom":"bash: ./<script>.sh: /bin/bash^M: bad interpreter: No such file or directory","command":"./<script>.sh","exit_code":null,"tool":"bash","version":"5.2","os":null,"date":"2026-10-28","cause":"the script has Windows CRLF line endings, so its shebang names /bin/bash plus a carriage return; no such file exists, and bash shows the CR as ^M","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"command","body":"sed -i 's/\\r$//' <script>.sh                    # strip the CRs (GNU sed; on macOS use dos2unix)\nprintf '*.sh text eol=lf\\n' >> .gitattributes   # stop git re-adding CRLF on Windows checkouts\ngit add --renormalize . && git commit -m \"Normalize shell scripts to LF\""},"repro":"file <script>.sh","check":"file <script>.sh | grep -q CRLF || echo ok","notes":"Typical after a Windows checkout with core.autocrlf=true, then running the script in WSL or a container. As a Docker ENTRYPOINT the same file fails with \"no such file or directory\" instead.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[]},"arms":[{"range":"5.2","status":"works"}],"dead_ends":[{"attempt":"bash <script>.sh","why":"skips the shebang, but every line still ends in a CR, so bash fails with $'\\r': command not found","reports":1},{"attempt":"make the script executable","why":"the file mode is not the problem; the interpreter path itself contains a carriage return","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-10-28T18:26:40.981126Z","updated_at":"2026-10-28T18:26:40.981126Z","last_confirmed_at":null,"ledger":{"first_seq":19,"last_seq":19,"head_hash":"db51345b9d1f74b38652456852348b60e84c72bce83d3fd71a4231990efbd094"}}
