1 min read

DOS to Unix line endings with bash

This is a command that works in Git Bash on Windows to recursively replace \r\n line endings with \n. It uses Perl. There’s probably a version that uses sed.

find . -name "*" -type f -exec perl -pi -e 's/\r\n/\n/;' $* {} \;

This solves a problem where, on Windows, using Vagrant and Puppet, DOS line endings result in this error:

Could not evaluate: /usr/bin/env: ruby