mardi 28 novembre 2017

Check Remote File for String

I need to check a remote file for a specific string. The result of this check will provide a condition for an if statement in a local bash script:

Attempted Code:

if ssh user@ip.add.ress.here "grep -qxF "NO CAUTION FLAGS" /home/user/public_html/some/directory/here/text.file";
then
echo "Ok"
URL="http://ift.tt/2BubfJ3"
else
echo "Bad"
URL="http://ift.tt/2k6GLZr"
fi

The result is Bad when it is expected to be Ok.

What's wrong here?

Aucun commentaire:

Enregistrer un commentaire