Question : Bash Scripting - Making a script that counts how many times it has been run

Hi,
I'm looking for a way to make a bash script that can count how many times it has been run, and save that vaule to a variable. I've tried experimenting with temp files and the likes but the results haven't been great, I'm not too experienced with bash, but I'm sure there must be a simple way to do this.

Any ideas?

Answer : Bash Scripting - Making a script that counts how many times it has been run

why not just append day and time to the filename then???

for example in your script:

    bkup_filename="my_backup_`/bin/date +"%Y_%h_%d_%T"`

This will create a string akin to "my_backup_2009_May_18_21:43:23"

Look at the other options to the date command to tailor this as you will... There is also the %s option that will print the seconds since the start of the unix epoch ( Jan 1, 1970). That can serve as your single number.

  --Eric
Random Solutions  
 
programming4us programming4us