Need help on addition in shell

i need shell script to add to numbers

#!/usr/bin/sh
a=1310601600 ------> epcho time of Thu, 14 Jul 2011 00:00:00 UTC
b=864000 -------> 10 days in sec
c=`expr $a+$b`
echo $c----1311465600> this output i will use this value to delete the data from MySQL db

next i need to set a=1311465600

it will go on... after 10 days

please let me know how to do this:wall:

~/$ a=1310601600
~/$ b=864000
~/$ c=$(($a + $b ))
~/$ echo $c
1311465600
~/$ a=$c
~/$ echo $a
1311465600

Or possibly

man at

hi thanks for your reply but this will work only one time, next time if we excute a = 1310601600 still same as old this because shell will read line by line one a=$c is last line so it will not update

Ahh, I think I see the issue now, you want to preserve a state so either the script re-writes itself (not a good plan and error prone :slight_smile: ) or you store the state in an external file, say /tmp/MySQL_clean_up.state

though you could use at and at the end of the run

at now +10 days -f $0.sh