You can pipe this to the end of your code to remove 0d
, 0h
, 0m
, or 0s
sed 's, 0[a-z],,g'
$ printf '%dd %dh %dm %ds\n' $((secs/86400)) $((secs%86400/3600)) $((secs%3600/60)) $((secs%60))
1d 0h 27m 3s
$ printf ... | sed 's, 0[a-z],,g'
1d 27m 3s