mirror of
https://github.com/burrowers/garble.git
synced 2025-09-26 20:01:16 +08:00

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.
20 lines
344 B
Bash
Executable File
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
|