Last active
June 21, 2023 11:22
-
-
Save verityj/32d913c5c506b0a1b441826217ba42ac to your computer and use it in GitHub Desktop.
Shell script: search in specified location for a file name string (not case sensitive) - do not show errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Written by: VerityJ | |
# Published on: https://gist.github.com/verityj | |
# | |
# Usage: ./find-here.sh location search-string | |
# search-string does not need " or * | |
if [ -z "$2" ] | |
then | |
echo "Usage: ./find-here.sh <location> <search-string> (note: no need for \" or *)" | |
echo "<location> example: ~ (user home) or . (current directory)" | |
exit 0 | |
fi | |
printf "\nSearching in '$1' for \"*$2*\" (case-insensitive) ...\n\n" | |
find $1 -iname "*$2*" -not -path "/System/Volumes/Data/*" -print 2>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment