12 lines
294 B
Bash
12 lines
294 B
Bash
#!/bin/bash
|
|
|
|
sleep 5000
|
|
|
|
secs=$SECONDS # utilise bash builtin SECONDS
|
|
hrs=$(( secs/3600 )); mins=$(( (secs-hrs*3600)/60 )); secs=$(( secs-hrs*3600-mins*60 )) # integer maths gives whole numbers
|
|
|
|
printf 'Time spent: %02d:%02d:%02d\n' $hrs $mins $secs
|
|
|
|
# output would be
|
|
# Time spent: 01:23:20
|