dotfiles/config/nix/unprocessed/config/scripts/remcrlf
Geoffrey Frogeye 1f61ceb395
nix: Migrate scripts
They're a bit slower to start :(.
Hopefully this is something that flakes will help with,
otherwise I'll find another way.
2023-11-26 21:04:58 +01:00

15 lines
220 B
Bash
Executable file

#!/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"