I have a script which I need to run with many input combinations. Currently I’m doing it with a perl script but I want to learn how to do it in a shell.
I need to run ./script.pl a b
for all combinations of a=1..100 and b =1..100
for ($a = 1; $a <100; $a++) {
for ($b = 1; $b <100; $b++) {
system "./script.pl $a $b";
}
}
I’m currently using bash, but zsh or tcsh work too.
You have 2 choices of syntax in bash for loops.
and
The first is similar to java loops for navigating lists etc, while the second is the old school for loop.
You can rewrite your loops as either of these.
or