jeudi 2 septembre 2021

IF statement does not perform the condition (bash)

this is the bash code:

FILE=`cat /home/_nonlocl/file2.txt | grep -o changed`

if [  "$FILE" = "changed"  ]; then
    echo "sending mail $send"
else
    echo "fingerprint has not changed"
fi

the problem is that the email is sent even if the word "changed" not exist in the file2.txt what the problem with the condition ?

Aucun commentaire:

Enregistrer un commentaire