Alright, I am attempting to add records to a database, but I need them to be divisible by 30 so that I can update them concurrently.
In order to do this I intended to use `date +%s` to get the current time in seconds, and then add 1 until the number was divisible by 30.
To simplify things I made $now equal to a number I knew was divisible by 30 for testing, but the modulus operator doesn't work.
I'm assuming my syntax is wrong, but everything I've looked at makes it look right to me. The increment operator wouldn't work either...
Any help would be much appreciated because I'm at a standstill with this nonsense. Thanks.
#now=`date +%s`
now=1213204110
tmp=0
if [ $now%30 != 0 ]
then
while [ $now%30 != 0 ]
do
tmp=`expr $now + 1`
now=$tmp
done
fi
echo $now