Created
April 21, 2022 02:49
-
-
Save AnakinTrotter/f852dc1e681fc1f00a877cc5d22089b8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
echo "Welcome to typeracer!" | |
echo "Type the following text as fast as you can: " | |
echo "" | |
printf "" > random.txt | |
# get random words | |
shuf data.txt -n 10 >> random.txt | |
# declare array: arr | |
readarray -t arr < random.txt | |
cat random.txt | tr '\r\n' ' ' | |
echo "" | |
echo "" | |
START_TIME=$(date +%s) | |
read input | |
END_TIME=$(date +%s) | |
ELAPSED_TIME=$((END_TIME - START_TIME)) | |
RES=$((ELAPSED_TIME*30)) | |
echo "" | |
echo "Words per minute:" | |
echo $RES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment