Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- read -p "Enter string to search for in the content of all files in current directory: " target
- count=0
- for entry in *
- do
- if [ -d "$entry" ]
- then
- echo "$entry is a directory, skipping..."
- elif grep -qF "$target" "$entry"
- then
- echo "File $entry: contains the string $target!"
- ((count++))
- fi
- done
- if [ $count -eq 0 ]
- then
- echo "$target not found in current directory"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement