Rev 7185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7185 | Rev 16960 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #! /bin/sh |
1 | #! /bin/sh |
2 | # This script produces a random list of words, according to |
2 | # This script produces a random list of words, according to |
3 | # the numbers given in the input string. |
3 | # the numbers given in the input string. |
4 | 4 | ||
5 | #Dictionary file directory |
5 | #Dictionary file directory |
6 |
|
6 | lang=$w_lang |
- | 7 | if [ ! $lang ]; then lang=$w_module_language; fi |
|
- | 8 | ||
7 | dicdir=bases/dic/$lang |
9 | dicdir=bases/dic/$lang |
8 | 10 | ||
9 | if [ ! -d $dicdir ]; then dicdir=bases/dic/en; lang=en; fi |
11 | 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 |
12 | if [ ! -e $dicdir/.cnt.$lang ]; then dicdir=bases/dic/en; lang=en; fi |
11 | echo $dicdir $lang > aaaa |
- | |
12 | cd $dicdir |
13 | cd $dicdir |
13 | 14 | ||
14 | . ./.cnt.$lang |
15 | . ./.cnt.$lang |
15 | for i in $wims_exec_parm |
16 | for i in $wims_exec_parm |
16 | do |
17 | do |
17 | count=`eval echo '$cnt'$i` |
18 | count=`eval echo '$cnt'$i` |
18 | if [ ! -z "$count" ]; then |
19 | if [ ! -z "$count" ]; then |
19 | random=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ") |
20 | random=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ") |
20 | n=$(( $random%$count+1 )) |
21 | n=$(( $random%$count+1 )) |
21 | head -$n $lang.$i | tail -1 |
22 | head -$n $lang.$i | tail -1 |
22 | fi |
23 | fi |
23 | done |
24 | done |