사용법 #

  • 코드 주석 참조

코드 #

#!/bin/sh
#
# /usr/local/bin/timer
# 
# copy into other scripts
# or export BEGIN and END from other scripts
# 
# Example:
# #!/bin/bash
# BEGIN=$SECONDS
# export BEGIN
#
# < your script >
# 
# END=$SECONDS
# export END
# timer
#
# NOTE -- For BEGIN and END to contain relevant data
#         the parent script must have the variable $SECONDS
#         available...ie. BASH or KSH scripts

TIME=`expr $END - $BEGIN`

HRS=`expr $TIME / 3600`
MIN=`expr $TIME % 3600 / 60`
SEC=`expr $TIME % 3600 % 60`

#printf 'Elapsed time: %.2d:%.2d:%.2d\n' $HRS $MIN $SEC
printf '%.2d:%.2d:%.2d' $HRS $MIN $SEC


powered by MoniWiki Powered by FreeBSD DNS Powered by DNSEver.com
last modified 2006-04-26 00:07:07
Processing time 0.0315 sec