Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- trap '' INT
- BEGIN=$(date +%s)
- BACK="\b\b\b\b\b\b\b"
- echo Tempo Conectado...
- while true; do
- NOW=$(date +%s)
- let DIFF=$(($NOW - $BEGIN))
- let MINS=$(($DIFF / 60))
- let SECS=$(($DIFF % 60))
- #only echo count if its different than the last time
- if [ "$DIFF" != "$OLDDIFF" ]
- then
- #backspace 4 times to reset stopwatch position
- #The '-e' enables \b to be interpreted correctly
- #The '-n' avoids the newline character at the end
- echo -ne $BACK
- echo $MINS:`printf $SECS`
- fi
- #define olddiff to current diff
- let OLDDIFF=DIFF
- done
Advertisement
Add Comment
Please, Sign In to add comment