#!/bin/bash EXCLUDES=( "*/node_modules/*" "*/.git/*" "*/__pycache__/*" "*/venv/*" ) EXCLUDE_PARAMS=() QUIET= if [[ $1 == '-q' ]]; then QUIET=1 fi for path in "${EXCLUDES[@]}"; do EXCLUDE_PARAMS+=("-not" "-path" "$path") done 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