vendredi 22 mai 2015

If/Else Statement's Shell Comparing more than 2 Values?

Quick question regrading if/else statements in shell, Right now I am trying to test if two different values are equal to a third

echo "CompareDateValues"
if [ "${TodaysDate}" = "${prevDate}" & "${currDate}" ]; then
    echo "Dates Are A Match : TodaysDate:${TodaysDate} = savedStateRunDates:${prevDate}"
else
    echo "Dates Are Not A Match : TodaysDate:${TodaysDate} = savedStateRunDates:${prevDate}"
    echo Exit
    exit 1
fi

As you can see from the code above I am trying to test if prevdate and currdate match Todaysdate but I can seem to get it working any help would be great

Aucun commentaire:

Enregistrer un commentaire