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