diff options
-rwxr-xr-x | typr.sh | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,7 +1,6 @@ #!/bin/sh words="the be of and a to in he have it that for they i with as not on she at by this we you do but from or which one would all will there say who make when can more if no man out other so what time up go about than into could state only new year some take come these know see use get like then first any work now may such give over think most even find day also after way many must look before great back through long where much should well people down own just because good each those feel seem how high too place little world very still nation hand old life tell write become here show house both between need mean call develop under last right move thing general school never same another begin while number part turn real leave might want point form off child few small since against ask late home interest large person end open public follow during present without again hold govern around possible head consider word program problem however lead system set order eye plan run keep face fact group play stand increase early course change help line" -alphanum="A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|0|1|2|3|4|5|6|7|8|9|,|.|?|\"|'|!|-" entered_text="" text="" @@ -98,6 +97,10 @@ typr_draw_time () { [ ! -z "$start" ] && printf "[s[$((areay-1));${areax}H[0m%s[u" "$(typr_get_time)" } +typr_calculate_wpm () { + printf "%s" "$((${#entered_text}*60000000000/(time_ns*5)))" +} + typr_show_results () { tput clear tput civis @@ -106,7 +109,7 @@ typr_show_results () { time_ns=$((now-start)) words="$(set -- $text ; printf "%s" "$#")" - wpm="$((words*60000000000/time_ns))" + wpm="$(typr_calculate_wpm)" acc="$(typr_calculate_acc)" printf "[%s;${areax}H%s" \ |