commit 30d75cfd633f1a8e352e28c8c6f171ff1343ed99
parent 83c3b1a76cd2a80b90b3929425f06a732cc23d70
Author: Jared Tobin <jared@jtobin.io>
Date: Fri, 29 Jan 2021 16:08:56 +0400
Don't count lines repeatedly.
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/conj b/conj
@@ -311,14 +311,14 @@ prompt() {
fi
}
+LENT=$(wc -l <<< "$DATA" | cut -f 1 -d' ')
LOOP=true
while $LOOP; do
clear
- lent=$(wc -l <<< "$DATA" | cut -f 1 -d' ')
- line=$(shuf -i 1-"$lent" -n 1)
+ line=$(shuf -i 1-"$LENT" -n 1)
cont=$(sed -n "$line"p <<< "$DATA")
echo "$cont" | cut -f 1 -d,
@@ -326,7 +326,7 @@ while $LOOP; do
prompt
echo "english: $(echo "$cont" | cut -f 6 -d,)"
- echo ""
+ echo
echo "voice: $(echo "$cont" | cut -f 2 -d,)"
echo "mood: $(echo "$cont" | cut -f 3 -d,)"
echo "tense: $(echo "$cont" | cut -f 4 -d,)"