From 8cd50fbf53eb34c284d4384ad7e2609eae15f031 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Fri, 10 Feb 2023 18:34:06 +0800 Subject: Update --- X11/rofi/pass.edit | 3 +-- tools/misc/flash.sh | 49 ++++++++++++++++++++++++++----------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/X11/rofi/pass.edit b/X11/rofi/pass.edit index 6187ef3..b5698fb 100755 --- a/X11/rofi/pass.edit +++ b/X11/rofi/pass.edit @@ -16,6 +16,5 @@ fi # Use detected terminal emulator to edit password coproc ( - alacritty -e pass edit $1 && pass $1 --clip - rofi -e "Copied: $1" + alacritty -e pass edit $1 && $(dirname $0)/pass.get $1 ) diff --git a/tools/misc/flash.sh b/tools/misc/flash.sh index bad8bb1..71d81a4 100755 --- a/tools/misc/flash.sh +++ b/tools/misc/flash.sh @@ -1,30 +1,33 @@ #! /bin/bash -CARD="$(cat ~/log/flashcards.md | shuf | head -1)" +while true; do + CARD="$(cat ~/log/flashcards.md | shuf | head -1)" -# Print the Question -<<<"$CARD" tr -s '\t' | cut -f1 -echo -echo ---- -echo + # Print the Question + <<<"$CARD" tr -s '\t' | cut -f1 + echo + echo ---- + echo -# Get the User Input -read -er INPUT + # Get the User Input + read -er INPUT -# Print the Answer -ANSER=$(<<<"$CARD" tr -s '\t' | cut -f2) -echo -echo ---- -echo + # 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 '☑' -else - tput setaf 1 - echo $ANSER -fi + # If answer correctly, print the checked box + if [[ "$INPUT" == "$ANSER" ]]; then + tput setaf 2 + echo '☑' + tput setaf 7 + else + echo $ANSER + fi -# Quit when getting Line Feed -read + echo + echo ---- + echo +done -- cgit v1.2.3-70-g09d2