Skip to content

Instantly share code, notes, and snippets.

@cedricvidal
Last active October 6, 2017 19:04
Show Gist options
  • Save cedricvidal/578cbcbc5d20c6b6dbab1dadfd2c6f2e to your computer and use it in GitHub Desktop.
Save cedricvidal/578cbcbc5d20c6b6dbab1dadfd2c6f2e to your computer and use it in GitHub Desktop.
Generates random words in an infinite 1Hz loop
WORDFILE="/usr/share/dict/words"
NUMWORDS=1
#Number of lines in $WORDFILE
tL=`awk 'NF!=0 {++c} END {print c}' $WORDFILE`
while :
do
rnum=$((RANDOM%$tL+1))
sed -n "$rnum p" $WORDFILE
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment