blob: 5bd48bc30fa4391e8fd3f748723724aaadb860c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#! /bin/bash
while true; do
CARD="$(cat ~/log/flashcards.md | shuf | head -1)"
# Print the Question
<<<"$CARD" tr -s '\t' | cut -f1
echo
echo ----
echo
# Get the User Input
read -er INPUT
# Print the Answer
ANSER=$(<<<"$CARD" tr -s '\t' | cut -f2)
echo
echo ----
echo
# If answer correctly, print the checked box
if [[ "$INPUT" == "$ANSER" ]]; then
tput setaf 2
echo '☑'
tput setaf 7
else
echo $ANSER
fi
echo
read
tput clear
done
|