Files
garble/scripts/crlf-test.sh
Emmanuel Chee-zaram Okeke 47296634f1 Include actual count of files with CRLF endings found
The script has been updated to include the actual count of files
with CRLF endings found.

The exit status of the script now accurately reflects the number of
files with incorrect line endings.
2023-06-22 09:37:06 +01:00

20 lines
344 B
Bash
Executable File

#!/bin/bash
file_count=$(grep \
--recursive \
--files-with-matches \
--binary \
--binary-files=without-match \
--max-count=1 \
--exclude-dir="\.git" \
$'\r' \
. | wc -l)
if [[ $file_count -gt 0 ]]; then
echo -e "Found $file_count file(s) with CRLF endings."
exit "$file_count"
fi
echo -e "No files with CRLF endings found."
exit 0