[BUG] Bash scripts with shebang lines produce no output on Windows

Resolved 💬 2 comments Opened Jan 19, 2026 by colemanpants Closed Jan 19, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code is not able to run local sh commands and see any output.

What Should Happen?

When running bash scripts that contain a shebang line (#!/bin/bash, #!/bin/sh, #!/usr/bin/env
bash) via the Bash tool on Windows (Git Bash/MSYS2), all stdout/stderr output is silently
suppressed. Scripts without shebangs work correctly.

Environment:

  • Platform: Windows (win32)
  • Shell: Git Bash (GNU bash 5.2.37, MSYS2)
  • Claude Code: Latest version (also tested older versions - same behavior)

Error Messages/Logs

Steps to Reproduce

This produces NO output:

echo -e '#!/bin/bash\necho "with shebang"' > /tmp/test1.sh && bash /tmp/test1.sh

# This works correctly:
echo 'echo "no shebang"' > /tmp/test2.sh && bash /tmp/test2.sh

Observations:

  • Scripts with shebang run successfully (exit code 0) but output is dropped
  • Scripts without shebang produce output correctly
  • bash -c "$(cat script.sh)" works as a workaround
  • Direct commands (echo "test") work fine
  • bash -c 'echo test' works fine
  • bash -v script.sh shows only the shebang line, then stops
  • Redirecting output to a file (bash script.sh > out.txt 2>&1) produces a 0-byte file
  • /bin/bash and /usr/bin/bash are identical on this system

Workarounds:

  • Remove shebang from scripts (not needed when invoking with bash script.sh)
  • Use bash -c "$(cat script.sh)" instead of bash script.sh

Additional notes:

  • Rolling back to previous Claude Code versions did not fix the issue, suggesting this may be

a server-side regression rather than a client issue.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.12 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗