counter=`cat /tmp/counter` ; echo "$counter+1" | bc > /tmp/counter
note that loading the /tmp/counter into the variable is a necessary indirection, the following:
echo "`cat /tmp/counter`+1" | bc > /tmp/counter
would not work as the output redirection gets triggered before the cat gets a chance to happen, so the file is emptied too early.
