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));