ffind - fuzzyfind from the current directory
# fuzzyfind from the current directory function ffind() { declare regex filetype if [[ $# -gt 2 ]] || [[ $# -eq 0 ]]; then return 1; fi if [[ $# -eq 2 ]] && [[ "$1" == '-d' ]]; then filetype='d'; fi regex="$(printf "%s" "${!#}" | /usr/bin/sed -E -e 's/([^][]|\[[^][]+\])/\1\.\*/g' -e '/\.\*\$\.\*$/s/\.\*\$\.\*$/\$/')" regex="${PWD}/.*${regex}" /usr/bin/find -x "${PWD}" -type "${filetype:-f}" -iregex "$regex" return 0 } ffind "searchstring" # default is file search ffind -d "[3-7]searchstring[5-9]" # search for directories ffind "searchstring$" # last character of file name is a "g" str="searchstring" str="[3-7]searchstring[5-9]" str="search/string$" printf "%s" "${str}" | /usr/bin/sed -E -e 's/([^][]|\[[^][]+\])/\1\.\*/g' -e '/\.\*\$\.\*$/s/\.\*\$\.\*$/\$/'