Guest User

Untitled

a guest
Aug 5th, 2011
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #!/bin/bash
  2. trap '' INT
  3.  
  4. BEGIN=$(date +%s)
  5. BACK="\b\b\b\b\b\b\b"
  6.  
  7.  
  8. echo Tempo Conectado...
  9.  
  10. while true; do
  11. NOW=$(date +%s)
  12. let DIFF=$(($NOW - $BEGIN))
  13. let MINS=$(($DIFF / 60))
  14. let SECS=$(($DIFF % 60))
  15.  
  16. #only echo count if its different than the last time
  17. if [ "$DIFF" != "$OLDDIFF" ]
  18. then
  19. #backspace 4 times to reset stopwatch position
  20. #The '-e' enables \b to be interpreted correctly
  21. #The '-n' avoids the newline character at the end
  22. echo -ne $BACK
  23. echo $MINS:`printf $SECS`
  24.  
  25.  
  26. fi
  27.  
  28. #define olddiff to current diff
  29. let OLDDIFF=DIFF
  30.  
  31. done
Advertisement
Add Comment
Please, Sign In to add comment