I have a cron that I am writing that will repeat every hour, and I need a simple way to pass a counter from the last run to the next run.My plan was to add the number to a file at the end, and then call it back at the beginning, e.g. At end of the first cron run:INC_COUNT=1echo $INC_COUNT > inc_counter.txtThen at the start of the second run:INC_COUNT_FILE=inc_counter.txtOLD_INC_COUNTER=$(cat $INC_COUNT_FILE)    So far so good, but now I need to increment that number.I tried:NEW_INC_COUNTER=$OLD_INC_COUNTER+1NEW_INC_COUNTER=$OLD_INC_COUNTER+1neither of which worked. What is the best way to increment this number?
increment a value pulled from a file
shell;variable;arithmetic
The following methods will work:NEW_INC_COUNTER=$((OLD_INC_Counter+1))((NEW_INC_COUNTER = OLD_INC_Counter+1))((OLD_INC_Counter+=1))((OLD_INC_Counter++))let NEW_INC_COUNTER = OLD_INC_Counter+1let OLD_INC_Counter+=1let OLD_INC_Counter++Good luck!