15 lines
257 B
Bash
15 lines
257 B
Bash
|
#!/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
|