I am trying to use grep in a while loop that runs curl.
i=1
while read -a row
do
test $i -eq 1 && ((i=i+1)) && continue
STRING=${row[2]}
CURL=`curl ${row[0]}${row[1]} | ${grep '$STRING'}`
echo $CURL
done < <(echo "SELECT check_address, check_page, check_string FROM checks" | mysql monitor)
The problem is in the line "${grep '$STRING'}". Since grep needs to be grep 'text' I tried different ways like grep '$var', ${grep $var} couldn't make it work.
SQL Output:
${row[0]} = http://www.codeoasis.com/
${row[1]} = index.php
${row[2]} = Copyright