#! /bin/sh
# This script produces a random list of words, according to 
# the numbers given in the input string.

# Security measure.
PATH=/usr/bin:/bin:/usr/games

#Dictionary file directory
lang=$w_module_language
dicdir=bases/dic/$lang

if [ ! -d $dicdir ]; then exit; fi
cd $dicdir

for i in $wims_exec_parm
do
 count=`cat .cnt.$lang.$i`
 if [ ! -z "$count" ]; then 
  n=$(( $RANDOM%$count+1 ))
  awk 'NR=='$n' {print; exit}' $lang.$i 
 fi
done

