Command line multiplications

Hi

I am trying to do take the current mins in the current hour and multply by 60 minutes to make them into seconds and substract

this way I am planning to do a Sleep on the process for the next closed zero hours
but this expression is not working

expr 3600 - (expr `date +%M` \* 60

Is this a homework assignment? (Homework assignments must be posted in the Homework and Coursework Forum.)

No this is not a home work, I am IT employee but after reading man pages, I got this
let "a = 3600-(`date +%M`*60)" ; sleep $a

I'm glad that you found something that works.

Assuming you are using a shell that accepts standard POSIX shell arithmetic expansions, and you want to wake up on the second (rather than just within a minute), or if you want intervals other than hours, you might also try:

#!/bin/ksh
round=${1:-3600}
sleep $((round -  (($(date +'%M * 60 + %S')) % round)))
date

By default, invoking this script without operands, it will sleep until the start of the next hour.

Invoking it with the operand 60, it will sleep until the start of the next minute.

And, invoking it with the operand 86400, it will sleep until midnight.