Skip to content

Instantly share code, notes, and snippets.

@cemerick
Created July 3, 2017 17:18
Show Gist options
  • Save cemerick/a6f889f6f4030f1dc19fb4184d67c6c3 to your computer and use it in GitHub Desktop.
Save cemerick/a6f889f6f4030f1dc19fb4184d67c6c3 to your computer and use it in GitHub Desktop.
#!/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