commit d281d2f17ae408f72a9471dff9bcc910ec5b624e parent d85074ad62f80577377fb38aaab3be98ed3d5d48 Author: Jared Tobin <jared@jtobin.io> Date: Fri, 29 Jan 2021 16:14:09 +0400 Just use shuf(1). Diffstat:
M | conj | | | 4 | +--- |
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/conj b/conj @@ -311,15 +311,13 @@ prompt() { fi } -LENT=$(wc -l <<< "$DATA" | cut -f 1 -d' ') LOOP=true while $LOOP; do clear - line=$(shuf -i 1-"$LENT" -n 1) - cont=$(sed -n "$line"p <<< "$DATA") + cont=$(shuf -n 1 <<< "$DATA") echo "$cont" | cut -f 1 -d,