From 5fd1b8cb3260d2aa44fad325d429aaaafb876db0 Mon Sep 17 00:00:00 2001 From: thomasabishop Date: Wed, 14 Dec 2022 19:00:05 +0000 Subject: [PATCH] Autosave: 2022-12-14 19:00:05 --- _scripts/random_revision_topic.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/_scripts/random_revision_topic.sh b/_scripts/random_revision_topic.sh index 117bef5..3e4b4b9 100755 --- a/_scripts/random_revision_topic.sh +++ b/_scripts/random_revision_topic.sh @@ -3,15 +3,9 @@ DIRS_TO_PARSE="../Algorithms ../Computer_Architecture ../Databases" for ele in $DIRS_TO_PARSE; do - MATCHES+=( $(find $ele -name "*.md" -type f) ) + FILE_MATCHES+=( $(find $ele -name "*.md" -type f) ) done -for i in ${MATCHES[@]} -do - echo $i -done +RANDOM_FILE_INDEX=$(( $RANDOM % ${#FILE_MATCHES[@]} + 0 )) -# Next steps: -# - Generate random number -# - Specify the range of the random number from 0 to length of $MATCHES -# - Return that index +echo "Revise this topic: ${FILE_MATCHES[$RANDOM_FILE_INDEX]}"