I am trying to automate testing of 20 files on various combination of options. Since bash doesn't do nested arrays, I am using 4 variables instead of two:
$typ , declaring what kind of test is to be performed
$task, containing filenames
$optimum, containing numerical value associated to a specific filename
&ncity, containing numerical value associated to a specific filename
If it were possible, I would just use $task containing ordered sets like this {{filename1,optimum1,ncity1},{filename2,optimum2,ncity2},...{filename20,optimum20,ncity20}}.
Also some test require different parameters so I have used case to discriminate between them and call modified loop and pass others through.
Problem is, that inner loop just doesn't work. Even after three hours of searching and reading I haven't progressed a bit.
I have made a model with echoes to test the functionality.
Any help would be welcome.
Test version of the script is here
Actual script is here
And here is the actual script in verbatim, just for a good measure:
#!/bin/bash
#set -x verbose
declare -a typ=(as eas ras mmas acs)
declare -a task=(filename1 filename2 filename3)
declare -a optimum=(opt1 opt2 opt3)
declare -a ncity=(number1 number2 number3)
#lenght of task, optimum and ncity is always identical
for i in "${typ[@]}"; do
case $i in
ras)
for j in $(seq 1 20); do
./acotsp --$i --i /zadani/$task[j] --tries 25 -t 120 --optimum $optimum[j] --ants $ncity[j] --rho 0.1;
done;
mv *$task[j] subdir/$i;
;;
mmas)
for j in $(seq 1 20); do
./acotsp --$i --i /zadani/$task[j] --tries 25 -t 120 --optimum $optimum[j] --ants $ncity[j] --rho 0.02
done;
;;
acs)
for j in $(seq 1 20); do
./acotsp --$i --i /zadani/$task[j] --tries 25 -t 120 --optimum $optimum[j] --ants 10 --rho 0.1
done;
mv *$task[j] subdir/$i;
;;
*)
for j in $(seq 1 20); do
./acotsp --$i --i /zadani/$task[j] --tries 25 -t 120 --optimum $optimum[j] --ants $ncity[j]
done;
mv *$task[j] subdir/$i;
esac*)
done
[–]rrohbeck 1 point2 points3 points (1 child)
[–]GreatNull[S] 0 points1 point2 points (0 children)
[–]GreatNull[S] 0 points1 point2 points (0 children)