Hello. I found these somewhere time ago. check if is what You need:
function timer() { if [[ $# -eq 0 ]]; then echo $(date '+%s') else local stime=$1 etime=$(date '+%s') if [[ -z "$stime" ]]; then stime=$etime; fi dt=$((etime - stime)) ds=$((dt % 60)) dm=$(((dt / 60) % 60)) dh=$((dt / 3600)) printf '%d:%02d:%02d' $dh $dm $ds fi } This is before the command t=$(timer) and this is after the command printf 'Elapsed time: %s\n' $(timer $t) example t=$(timer) copy /dev/null /dev/zero printf 'Elapsed time: %s\n' $(timer $t) Greetings Josep El vie, 19-03-2010 a las 10:19 -0700, Mike McClain escribió: > I've written a function to print elapsed time similar to /usr/bin/time > but can be called at the beginning and end of a script from within > the script. Occasionally I get an error: '8-08: value too great for base' > It's caused by the difference in these 2 command strings but I can't for > the life of me see what's going on. > > now='09:07:16'; startHr=${now%%:*}; startHR=${startHr#*0}; echo $startHr; > 09 > > str=09; str=${str#*0}; echo $str; > 9 > > Thanks, > Mike > -- > Satisfied user of Linux since 1997. > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org > > -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1269865700.29265.2.ca...@mail.navegants.net