supas14 0 Newbie Poster

I'm trying to write code to simulate the shortest job next or shortest process next using bash and I'm having some trouble grasping the logic behind it. I read from a file that has proces name, arrival time, and burst time. So let say

A | 1 | 5
B | 2 | 3
C | 3 | 2
D | 4 | 4
E | 6 | 3

Heres my thought process so far. I'm using bash script so I broke up the data into 3 separate arrays. Process, arrival, and burst. I created a 4th array called totaltime. In reality I know that this is what the schedule should look like

|1|Process A|5|Process C|7|Process B|10|Process D|14|Process E|17|

My code logic is first check the arrival array and find the minimum and that row corresponds to the first process to be scheduled. Next Check which of the processes have arrival times that are less than the 1st process's burst time. Within that set of processes find the smartest burst time. Now this is where I'm stuck at. Do I use a if statement to check which of the processes are less than the 1st burst time and then use a for loop to find the smallest burst time of the set? After that how would I schedule the third process?