Skip to content

Instantly share code, notes, and snippets.

@purpleidea
Created February 24, 2021 23:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save purpleidea/e7d7d8c52aa413c97d1e4142e9a9bf1f to your computer and use it in GitHub Desktop.
Save purpleidea/e7d7d8c52aa413c97d1e4142e9a9bf1f to your computer and use it in GitHub Desktop.
ifind
# case insensitive find, eg: ifind <pattern>[ dir1[ dir2[ dirN...]]]
function ifind() {
pat="$1"
shift
if [ "$#" = "0" ]; then
set "."
fi
for d in "$@"; do
#find "$d" -iname "*$pat*" # normal
find "$d" -iname "*$pat*" 2> /dev/null # hide can't read errors
shift
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment