Created
July 3, 2017 17:18
-
-
Save cemerick/a6f889f6f4030f1dc19fb4184d67c6c3 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/bash | |
filename="$1" | |
wait="🕜" | |
# test 🕜🕜🕜🕜pausing | |
function keystroke-delay { | |
delay=`bc <<END | |
scale=2 | |
0.02 + (0.1 * ($RANDOM / 32767)) | |
END` | |
sleep $delay | |
} | |
while IFS='' read -r line | |
do | |
for i in $(seq 1 ${#line}) | |
do | |
char="${line:i-1:1}" | |
if [ "$char" = $wait ]; then | |
sleep 1 | |
else | |
echo -n "$char" | |
if [ "$char" != " " ]; then | |
keystroke-delay | |
fi | |
fi | |
done | |
echo | |
done < "$filename" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment