Created
July 15, 2023 13:09
-
-
Save cdot65/236cb37e01cd93d897bb9f589c5b5974 to your computer and use it in GitHub Desktop.
Search for files that contain a pattern within nested subdirectories. Example: ```./search.sh "search string"```
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/bash | |
if [ "$#" -ne 1 ]; then | |
echo "You must enter exactly 1 command line argument (the string to search for)" | |
exit 1 | |
fi | |
grep -rnw './' -e "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment