fix-line-endings

Convert CRLF line endings to LF in shell scripts and text files.

3|Updated Oct 17, 2025
One-click install
npx skills add https://github.com/ManuelKugelmann/BitBot --skill fix-line-endings
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fix-line-endings
Source: https://github.com/ManuelKugelmann/BitBot/tree/main/.bitbot/internal/container/templates/bitbot-dev/.claude/skills/fix-line-endings
Command: npx skills add https://github.com/ManuelKugelmann/BitBot --skill fix-line-endings

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Resolves common script execution errors caused by inconsistent line endings (CRLF vs. LF), especially when moving files between Windows and Unix environments. This prevents frustrating "command not found" errors.

Core Features & Use Cases

  • Automatic Conversion: Converts Windows-style CRLF line endings to Unix-style LF.
  • Error Prevention: Eliminates /bin/bash: $'\r': command not found errors.
  • Use Case: Automatically clean up all shell scripts in your project before deployment to a Linux server, ensuring they run without issues.

Quick Start

Fix line endings in 'myscript.sh' and 'another_script.py'. .claude/skills/fix-line-endings/scripts/fix-line-endings.sh myscript.sh another_script.py

Frequently Asked Questions about fix-line-endings

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix CRLF line ending errors in shell scripts?

Convert CRLF line endings to LF using this Skill to eliminate '/bin/bash: $'\r': command not found' errors. It automatically detects and converts Windows-style line endings in shell scripts and text files, preserving file permissions and working across Unix-like environments including CI pipelines.

Can I use this to fix line endings across multiple script files at once?

Yes. Pass multiple file paths as arguments to fix line endings in all scripts simultaneously. The Skill processes each file individually with existence checks and provides progress updates, making it ideal for cleaning entire project directories before deployment.

What happens if dos2unix isn't available on my system?

The Skill implements a two-stage conversion: it attempts dos2unix first, then falls back to sed if unavailable. This ensures line ending conversion works across different Unix-like environments regardless of which tools are pre-installed.

When do line ending mismatches occur between Windows and Unix?

Line ending inconsistencies happen when files are transferred from Windows (CRLF) to Unix systems (LF) without conversion. Scripts fail to execute, text files display incorrectly, and CI pipelines break. This Skill resolves those issues automatically.

Does this Skill work in CI/CD pipelines and pre-commit workflows?

Yes. The Skill is designed for CI pipelines and pre-commit checks to automatically fix line endings before deployment. It validates arguments and checks file existence, making it safe for automated workflows where script execution errors must be prevented.

Will file permissions be preserved after conversion?

Yes. The Skill preserves original file permissions during line ending conversion, ensuring scripts remain executable and access controls stay intact after the fix is applied.

Related Skills