15 lines
257 B
Bash
Executable File
15 lines
257 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
WORDFILE="/usr/share/dict/words"
|
|
NUMWORDS=${1:-5}
|
|
|
|
#Number of lines in $WORDFILE
|
|
tL=`awk 'NF!=0 {++c} END {print c}' $WORDFILE`
|
|
|
|
for i in `seq $NUMWORDS`
|
|
do
|
|
rnum=$(($RANDOM*$RANDOM))
|
|
let "rnum %= $tL"
|
|
sed -n "$rnum p" $WORDFILE
|
|
done
|