aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2023-02-10 14:42:14 +0800
committerHsieh Chin Fan <pham@topo.tw>2023-02-10 14:42:14 +0800
commite373f5c47c5f0b7ead90841cce36dcfa161baf7c (patch)
treec0cc5026ad7ab17b4f78b3e4ddfe91a684944ea7 /tools
parentce9a8abca665eae8f6d9973cdb48f196eda063d9 (diff)
Update
Diffstat (limited to 'tools')
-rwxr-xr-xtools/misc/flash.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/misc/flash.sh b/tools/misc/flash.sh
new file mode 100755
index 0000000..bad8bb1
--- /dev/null
+++ b/tools/misc/flash.sh
@@ -0,0 +1,30 @@
1#! /bin/bash
2
3CARD="$(cat ~/log/flashcards.md | shuf | head -1)"
4
5# Print the Question
6<<<"$CARD" tr -s '\t' | cut -f1
7echo
8echo ----
9echo
10
11# Get the User Input
12read -er INPUT
13
14# Print the Answer
15ANSER=$(<<<"$CARD" tr -s '\t' | cut -f2)
16echo
17echo ----
18echo
19
20# If answer correctly, print the checked box
21if [[ "$INPUT" == "$ANSER" ]]; then
22 tput setaf 2
23 echo '☑'
24else
25 tput setaf 1
26 echo $ANSER
27fi
28
29# Quit when getting Line Feed
30read