Sunny
Sunny

Reputation: 175

Coversion of bat file in windows to automated script in osx

I have executed a simulation in java. I made an automated script a.bat in windows which takes the below parameters and simulation.jar file and appends outputs to a file.

These are the contents of the a.bat file

FOR %%R IN (3 6 9 12 15 18 21) 
DO FOR %%V IN (5 10 15 20)  
DO FOR %%S IN (5 10 15 20 25 30 35 40 45 50 55 60) 
DO FOR %%C IN (10 20 30 40 50 60) 
DO FOR %%G IN (2 4 6) 
DO FOR %%P IN (0.2 0.4 0.6 0.8 1)  
DO FOR %%I IN (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) 
DO  java -jar simulation.jar %%R %%V %%S %%C %%G %%P %%I

Now I want to execute the same thing in mac osx can anyone help me.

Upvotes: 1

Views: 77

Answers (1)

ewan.chalmers
ewan.chalmers

Reputation: 16235

With Darwin you can use the bash shell I think? So you can do a for loop in a bash script:

for R in 3 6 9 12 15 18 21 
do for V in 5 10 15 20
do for S in 5 10 15 20 25 30 35 40 45 50 55 60
do for C in 10 20 30 40 50 60
do for G in 2 4 6
do for P in 0.2 0.4 0.6 0.8 1
do for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
do java -jar simulation.jar $R $V $S $C $G $P $I
done
done
done
done
done
done
done

Upvotes: 1

Related Questions