Skip to content

Instantly share code, notes, and snippets.

@cdot65
Created July 15, 2023 13:09
Show Gist options
  • Save cdot65/236cb37e01cd93d897bb9f589c5b5974 to your computer and use it in GitHub Desktop.
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"```
#!/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