I am trying to get the difference of 2 dates in epoch form and convert the number back to days:
EXPIRYEPOCH=$(date --date="$EXPIRYDATE" +%s) TODAYEPOCH=$(date --date="$TODAYSDATE" +%s) DAYSLEFT=$(expr ($EXPIRYEPOCH - $TODAYEPOCH) / 86400 )
DAYSLEFT evaluation fails in the above – whereas a single evaluation of subtraction succeeds in the below:
DAYSLEFT=$(expr $EXPIRYEPOCH - $TODAYEPOCH)
What is the proper formatting to be used to set the
DAYSLEFT variable with subtraction followed by division?