#!/usr/bin/env bash
#! nix-shell -i bash --pure
#! nix-shell -p bash 

# Removes CRLF (^M or \r) from a file

#sed -e "s/^M//" "$1" -i

tmpfile=$(mktemp)

cp "$1" "$tmpfile"
tr -d '\r' < "$tmpfile" > "$1"
rm "$tmpfile"