Subversion Repositories wimsdev

Rev

Rev 7171 | Rev 16960 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 reyssat 1
#! /bin/sh
2
# This script produces a random list of words, according to 
3
# the numbers given in the input string.
4
 
5
#Dictionary file directory
6
lang=$w_module_language
7
dicdir=bases/dic/$lang
8
 
7185 bpr 9
if [ ! -d $dicdir ]; then dicdir=bases/dic/en; lang=en; fi
10
if [ ! -e $dicdir/.cnt.$lang ]; then dicdir=bases/dic/en; lang=en; fi
11
echo $dicdir $lang > aaaa
14 reyssat 12
cd $dicdir
13
 
7171 obado 14
. ./.cnt.$lang
14 reyssat 15
for i in $wims_exec_parm
16
do
17
 count=`eval echo '$cnt'$i`
18
 if [ ! -z "$count" ]; then 
1928 bpr 19
  random=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
20
  n=$(( $random%$count+1 ))
14 reyssat 21
  head -$n $lang.$i | tail -1
22
 fi
23
done
24