wsl-bash-crlf-or-tempfile

wsl-bash-crlf-or-tempfile is a skill for Claude Code, Codex from chen3feng/agent-skills. It costs 48 tokens per session (2,449 once invoked), scanned A, original, Apache-2.0.

A troubleshooting rule for running Bash scripts in Windows Subsystem for Linux, or WSL. It explains how Windows CRLF line endings can break Bash commands when a script is passed from PowerShell or cmd.

In plain words
What is it for?
Running generated multi-line Bash commands through wsl.exe and fixing problems with options, heredocs, conditionals, and command names.
Why use it?
It helps diagnose confusing shell errors caused by hidden carriage-return characters rather than incorrect Bash logic.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Running generated multi-line Bash commands through wsl.exe and fixing problems with options, heredocs, conditionals, and command names.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chen3feng/agent-skills/wsl-bash-crlf-or-tempfile
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chen3feng/agent-skills --skill wsl-bash-crlf-or-tempfile
Clone the repo
git clone --depth 1 https://github.com/chen3feng/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wsl-bash-crlf-or-tempfile

README.md
[![agentmods](https://agentmods.dev/badge/skills/chen3feng/agent-skills/wsl-bash-crlf-or-tempfile/github.svg)](https://agentmods.dev/skills/chen3feng/agent-skills/wsl-bash-crlf-or-tempfile)
Your own site
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/wsl-bash-crlf-or-tempfile"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/wsl-bash-crlf-or-tempfile/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wsl-bash-crlf-or-tempfile

Your own site · 80×15
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/wsl-bash-crlf-or-tempfile"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/wsl-bash-crlf-or-tempfile.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,449 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.02449
Opus 5 $0.00024 $0.01224
Sonnet 5 $0.00010 $0.00490
Haiku 4.5 $0.00005 $0.00245

Measured 10d ago against content hash b2201e2a57a0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

wsl-bash-crlf-or-tempfile scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/wsl-bash-crlf-or-tempfile/SKILL.md · 228 lines

How it starts

The opening of the file, as written. The whole thing — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.

WSL bash scripts: kill CRLF, or route through a temp file

When to use

You're driving a Linux toolchain from Windows: a PowerShell or .bat script builds a multi-line bash body and runs it in WSL via wsl.exe -d <distro> -- bash -c "<body>". Symptoms that land you here:

  • bash: line 1: set: pipefail : invalid option name (note the phantom space before the : — that's a literal \r).
  • bash: line N: $'<something>\r': command not found.
  • Heredoc bodies that silently truncate at the wrong line.
  • A bash if/then block reports a syntax error at a line that looks perfectly fine in your editor.

It's not "my bash is wrong"; it's CRLF contamination crossing the Windows → WSL boundary.

Problem

PowerShell's here-strings (@' … '@, @" … "@) and .bat echo lines emit CRLF by default. When you hand the resulting string to wsl.exe bash -c "$body", Linux bash reads the \r as a normal character that is part of the previous token:

  • set -euo pipefail\r becomes the command set with options -e, -u, -o, pipefail\r. bash prints set: pipefail : invalid option name — the "space" before the colon in the error message is actually the carriage return.
  • FOO=bar\r sets FOO to bar\r, and the later comparison [ "$FOO" = "bar" ] silently fails.
  • fi\r / done\r are accepted as words, so the if / for is never closed and the parser reports an error many lines below the actual cause.

Why it's easy to miss:

  • Your editor (VS Code, Notepad++, etc.) happily hides \r.
  • The CRLF shows up only when the script crosses into WSL. If you run the same body via Invoke-Expression on Windows, or dump it to disk and type it, everything looks fine.
  • The usual quoting-skills reflex (escape the dollar signs, quote the body, etc.) doesn't help — this is a line-ending issue, not a quoting issue.

The related \0 NUL trap at the API boundary is a different problem (see Pitfalls below).

Solution

Two reliable fixes. Prefer #2 for anything beyond a one-liner — it composes better and gives you a debuggable artifact.

Read the full file on GitHub · 228 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 228 lines · 48 tokens per session scan A b2201e2a57a0

Subscribe to this mod's changes

wsl-bash-crlf-or-tempfile is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 48 tokens to every session and 2,449 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

wispr-flow-debug

Debug and test the Wispr Flow AutoHotkey dictation triggers (Copilot key + extra keys) from WSL by deploying macos.ahk to the Windows Desktop, reloading AutoHotkey, and reading the debug log. Use when an activation/trigger key isn't starting/stopping dictation, when the overlay clicks land wrong, or when verifying a…

sfc-gh-eraigosa/dotfiles · 87 tokens

windows-dev-process-cleanup

A Windows troubleshooting guide for auditing and safely cleaning leftover development processes and UWP background tasks. UWP is Windows' platform for packaged apps.

bahayonghang/my-ai-cli-toolkit · 124 tokens

flare

Manage Flare error tracking and performance monitoring using the flare CLI. Use when the user wants to list, triage, resolve, snooze, or debug errors; manage projects; create projects and retrieve API keys; check error counts; investigate slow routes, queries, jobs, or commands; view aggregated performance data and…

freekmurze/dotfiles · 78 tokens

audit-architecture

Run an application-wide, read-only architecture audit that finds materially useful simplifications in a codebase's data structures, state representation, control flow, algorithms, and ownership boundaries. Fans out bounded read-only agents per subsystem, verifies every finding against the repo, and ranks results P0 to…

freekmurze/dotfiles · 119 tokens

powershell-docs

PowerShell 7.6 + Windows PowerShell 5.1 — variables, arrays, hashtables, functions, classes, remoting, modules, DSC.

pledgeandgrow/pledge-skills · 39 tokens

oh-my-posh

Install, configure, or troubleshoot Oh My Posh/ohmyposh: shell init, themes, segments, Nerd Font icons, and prompt setup on PowerShell, zsh, bash, or fish.

JanDeDobbeleer/oh-my-posh · 47 tokens