Mac - script to report typing WPM
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I want a command-line program of some kind which logs my current WPM along with a timestamp to standard output at some interval (once a second seems good). Keystrokes are fine if locating characters typed is too difficult.

I prefer scripts to compiled programs.

awarded to Wikimedia

Crowdsource coding tasks.

1 Solution


#!/bin/sh
prompt="Start typing a piece of text. Press Ctrl-d twice to finish."
echo "\n$prompt \n"
start_time=`date +%s`
words=`cat|wc -w`
end_time=`date +%s`  
speed=`echo "scale=2; $words / ( ( $end_time - $start_time ) / 60)" | bc`
echo "\nYou have a typing speed of $speed words per minute."