Your posted bash script (at post #1) is a good start, but full of syntactical and logical errors.
You should read a bash scripting tutorial. There are many on the net, or you can just buy a book (I'm old, so prefer those tree-based-things).
My suggestion is to start very simply: Write a script that'll search for files containing only one
keyword and print the results. Test it out.
Then work out the syntax of how you are going to write the script to handle two
keywords, and decide how you are going to parse firstword and
secondword or firstword or
will return something like
"we found drum in 2 lines
Might be more useful to have it reply:
We found "drum" in these files: ( /full/path/to/filenames
list follows ..)
So please start very
simply, and then work forwards.
You might like to read, absorb, and sleep on, the output of man grep
You are welcome to post the scripts you have tried, with the errors you encounter, and we'll do our best to help you. But you have to do your homework and read up on the basics.
can be furiously complicated (as I know to my cost), but you'll probably get acquainted with it.