Guest User

Untitled

a guest
May 24th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Section to timed between START an FINISH...
  4.  
  5. START=$SECONDS
  6.  
  7. echo "sleep 30s"
  8. sleep 30s
  9.  
  10. FINISH=$SECONDS
  11.  
  12. timer ()
  13. {
  14. hrs="$((($FINISH - $START)/3600))hrs"
  15. min="$(((($FINISH - $START)/60)%60))min"
  16. sec="$((($FINISH - $START)%60))sec"
  17.  
  18. if [[ $(($FINISH - $START)) -gt 3600 ]]; then echo "$hrs, $min, $sec"
  19. elif [[ $(($FINISH - $START)) -gt 60 ]]; then echo "$min, $sec"
  20. else echo "$sec"
  21. fi
  22. }
  23.  
  24. echo -n "Elapsed time: "; timer
Add Comment
Please, Sign In to add comment