diff --git a/test.sh b/test.sh index 1e92b2a..37dcdba 100755 --- a/test.sh +++ b/test.sh @@ -25,8 +25,14 @@ function show_time () { if((num>59));then ((min=num%60)); ((num=num/60)) if((num>23));then ((hour=num%24)); ((day=num/24)) else ((hour=num)); fi; else ((min=num)); fi; else ((sec=num)); fi - - echo "$day"d "$hour"h "$min"m "$sec"s + + t='' + if [ $day != 0 ]; then t+="$day days "; fi + if [ $hour != 0 ]; then t+="$hour hours "; fi + if [ $min != 0 ]; then t+="$min mins "; fi + if [ $sec != 0 ]; then t+="$sec secs "; fi + + echo $t } show_time ${1} \ No newline at end of file