Linux Mastering Development

Set a variable to the result of a division and subtraction command

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 ) The DAYSLEFT evaluation fails in the above – whereas a single evaluation of subtraction succeeds in the below: DAYSLEFT=$(expr $EXPIRYEPOCH – $TODAYEPOCH) […]