I have a bash script that inputs lines into a html file, this is done in a loop through an array. Later in the script i loop through a different array that may contain the same values as in the previous array so i want to check if a string from my array appears in my html file already do this, else do something else.
currently i have this:
if grep -rnw MY_HTML_FILE.html -e string_from_array ; then echo "string found">>MY_HTML_FILE.html else echo "string not found">>MY_HTML_FILE.html fi
this only ever seems to go with string not found which means when the script has finished and i check the file i have duplicate enteries.