From e2f2acb54674120b8702659dbcac50e8dd66c245 Mon Sep 17 00:00:00 2001 From: binaryDiv Date: Mon, 31 May 2021 14:25:39 +0200 Subject: [PATCH] find_crlf: Add quiet mode --- bin/find_crlf | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/find_crlf b/bin/find_crlf index 011f120..6eb952a 100755 --- a/bin/find_crlf +++ b/bin/find_crlf @@ -9,9 +9,22 @@ EXCLUDES=( EXCLUDE_PARAMS=() +QUIET= + +if [[ $1 == '-q' ]]; then + QUIET=1 +fi + for path in "${EXCLUDES[@]}"; do EXCLUDE_PARAMS+=("-not" "-path" "$path") done -find . -type f "${EXCLUDE_PARAMS[@]}" -exec file '{}' \; | grep 'CRLF' +find_grep_crlf() { + find . -type f "${EXCLUDE_PARAMS[@]}" -exec file '{}' \; | grep 'CRLF' +} +if [[ -n $QUIET ]]; then + find_grep_crlf | cut -d: -f1 +else + find_grep_crlf +fi