How can I convert seconds to hours, minutes and seconds?
show_time() { ????? } show_time 36 # 00:00:36 show_time 1036 # 00:17:26 show_time 91925 # 25:32:0
All above is for bash, disregarding there "#!/bin/sh" without any bashism will be:
convertsecs() { h=`expr $1 / 3600` m=`expr $1 % 3600 / 60` s=`expr $1 % 60` printf "%02d:%02d:%02d\n" $h $m $s }