#!/bin/sh s=0 m=0 h=0 while : ; do sleep 1s if [[ $s == 60 ]]; then m=$((m+1)); s=0 elif [[ $m == 60 ]]; then h=$((h+1)); m=0 fi s=$((s+1)) clear echo "$h:$m:$s" done