Skip to content

Instantly share code, notes, and snippets.

@RobSpectre
Created January 28, 2015 18:57
Show Gist options
  • Save RobSpectre/63d108e1aa30491532a0 to your computer and use it in GitHub Desktop.
Save RobSpectre/63d108e1aa30491532a0 to your computer and use it in GitHub Desktop.
Random Words
#!/bin/sh
WORDFILE="/usr/share/dict/words"
NUMWORDS=5
#Number of lines in $WORDFILE
tL=`awk 'NF!=0 {++c} END {print c}' $WORDFILE`
for i in `seq $NUMWORDS`
do
rnum=$((RANDOM%$tL+1))
sed -n "$rnum p" $WORDFILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment