This script counts one by one every time the user runs the script. “./scriptname reset” reset the counter.
!/bin/bash
if [ "$1" = "reset" ]
then
rm -rf fstore
fi
sayi=0
if [ -f fstore ]
then
sayi=`cat fstore`
fi
let sayi=$sayi+1
echo "INCREMENTING"
echo $sayi > fstore
echo -e -n "CURRENT="
echo $sayi
uses fstore file to remember the previous number.
Buy me a beer