Last active
June 26, 2019 00:27
-
-
Save grepsedawk/09462d21560b755e3105b48504a0e462 to your computer and use it in GitHub Desktop.
Bash Stopwatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First install xclip (if debian based, apt-get install xclip should work) | |
# Add to .bashrc or .zshrc | |
function stopwatch() ( | |
trap 'ctrl_c $1' INT | |
function ctrl_c() { | |
echo -n "#$1 work Development $(date -u --date @$((`date +%s` - $date1)) +%-Hh%-Mm)" | xclip -sel clip | |
echo "\n\n#$1 work Development $(date -u --date @$((`date +%s` - $date1)) +%-Hh%-Mm) was sent to your clipboard." | |
exit | |
} | |
date1=`date +%s`; | |
echo "Currently working on '#$1':" | |
while true; do | |
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r"; | |
sleep 0.1 | |
done | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment