Increment userid in file

Hello,

does anyone know how to increment a userid(number) written in any scripting language that works on a shell?
For example:

I have a HTML file in this format:

userid:
name:
telephone:

Every time I execute my script it adds the same fields, except with the userid incremented. Like this:

userid: 0

userid: 1

userid: 2

My script isn't always running, so the variable userid should be saved somewhere, so it won't reset and starts with userid 0 once I re-run the script.

Thanks.

I'd suggest just writing it out to a file someplace. eg:

number=`cat tempfile`
do_stuff_with $number
number=`expr $number + 1`
echo $number > tempfile

Thanks, that was exactly what I needed!

I also found a way to set a variable in any of the bash initializing scripts while doing the same thing, except without creating a new file. So it reads the variable userid from inside the bash script(s).