First commit
[anna.git] / example / diameter / launcher / createBatch.sh
1 #!/bin/ksh
2
3 salir () {
4    echo
5    echo $1
6    echo
7    exit
8 }
9
10 uso () {
11    echo "Use: $0 <directory with .hex/.xml files> [operation]"
12    echo
13    echo "     operation: code|[decode]"
14    echo
15    echo "     Example: $0 Pending/NOKIA"
16    echo
17    salir
18 }
19
20 #############
21 # EJECUCION #
22 #############
23 [[ "$1" = "" ]] && uso
24 DIR=$1
25 OP=$2
26 [[ "$OP" = "" ]] && OP=decode
27 [[ "$OP" != "decode" ]] && OP=code
28 [[ ! -d $DIR ]] && salir "Directory $DIR not found"
29
30 > batch.txt
31
32 [[ "$OP" = "decode" ]] && { EXT1=hex ; EXT2=xml ; }
33 [[ "$OP" = "code" ]] && { EXT1=xml ; EXT2=hex ; }
34
35 for i in `find $DIR/ -name "*.${EXT1}"`
36 do
37    echo ".\c"
38    echo "$OP|$OP|$i|${i}.${EXT2}" >> batch.txt
39 done
40
41 echo
42 echo "Created batch.txt"
43 echo
44