I'm trying to make a simple search script but cannot get it right. The script should search for keywords inside files. Then return the file paths in a variable. (Each file path separated with \n).
#!/bin/bash
SEARCHQUERY="searchword1 searchword2 searchword3";
for WORD in $SEARCHQUERY
do
GREPINPUT=$GREPINPUT" | grep --ignore-case --files-with-matches -e '$WORD'";
done
FINDFILES=$(find . -maxdepth 2 -name \*.c -type f $($GREPINPUT));
OK, but I am trying to insert a concatenated string inside another string and evaluate it. I have been playing with this for hours but cannot get it right.