claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude Code consistently creates files with Windows line endings on Linux systems

Open pm0code opened this issue 6 months ago • 14 comments

Description: Despite being on Ubuntu Linux and explicitly adding instructions to CLAUDE.md, Claude Code continues to create shell scripts and text files with Windows line endings (CRLF) instead of Unix line endings (LF). This causes "No such file or directory" errors when executing scripts.

Steps to Reproduce:

  1. Use Claude Code on Linux (Ubuntu 24.04)
  2. Ask it to create any shell script
  3. Try to execute the script with ./script.sh
  4. Get error: "unable to execute ./script.sh: No such file or directory"

Expected Behavior: Files should be created with Unix line endings (\n) on Linux systems

Actual Behavior: Files are created with Windows line endings (\r\n), requiring manual conversion with sed -i 's/\r$//'

Environment:

  • OS: Ubuntu 24.04.2 LTS
  • Kernel: 6.11.0-26-generic
  • Claude Code version: [your version]

Impact:

  • Breaks workflow repeatedly
  • Requires manual intervention for every script
  • Even after adding explicit instructions to CLAUDE.md, the issue persists

Suggested Fix: Claude Code should detect the OS and use appropriate line endings automatically, or at minimum respect the CLAUDE.md instructions.

pm0code avatar Jul 01 '25 15:07 pm0code