diff --git a/snippets/time_duration.sh b/snippets/time_duration.sh index a28d3c2..140d962 100755 --- a/snippets/time_duration.sh +++ b/snippets/time_duration.sh @@ -18,17 +18,30 @@ function time_duration () { local __t_s=`expr $__t_rest_h - $__t_m \\* 60` if [[ $__t_h -gt 0 ]]; then + if [[ $__t_h -lt 10 ]] ; then - echo " $__t_h h : $__t_m min : $__t_s sec" - else - echo "$__t_h h : $__t_m min : $__t_s sec" + __t_h=" $__t_h" fi - elif [[ $__t_m -gt 0 ]]; then if [[ $__t_m -lt 10 ]] ; then - echo " $__t_m min : $__t_s sec" - else - echo "$__t_m min : $__t_s sec" + __t_m=" $__t_m" fi + if [[ $__t_s -lt 10 ]] ; then + __t_s=" $__t_s" + fi + + echo "$__t_h h : $__t_m min : $__t_s sec" + + elif [[ $__t_m -gt 0 ]]; then + + if [[ $__t_m -lt 10 ]] ; then + __t_m=" $__t_m" + fi + if [[ $__t_s -lt 10 ]] ; then + __t_s=" $__t_s" + fi + + echo "$__t_m min : $__t_s sec" + else if [[ $__t_s -lt 10 ]] ; then echo " $__t_s sec"