This little timer script writes every second into $HOME/test.log. Feel free to use it as testing script or snippet for your own projects.

 

#!/bin/bash

COUNTER=1
while [ true ]
do
     echo " $COUNTER " >> ~/test.log
     COUNTER=$[$COUNTER +1]
     sleep 1
done