Results 1 to 2 of 2
I've tried to do a FCFS or FIFO algorithm , so i did it in another language that I'm more familiar and tried to "translate" it. But i get unspecific ...
- 04-18-2011 #1Just Joined!
- Join Date
- Feb 2010
- Posts
- 3
Help with this code please.
I've tried to do a FCFS or FIFO algorithm , so i did it in another language that I'm more familiar and tried to "translate" it. But i get unspecific syntax errors in it which aren't very helpful.
Can someone tell me where am i going wrong here.cheers.
Code:#!/bin/bash i=0 a[$i]=0; b[$i]=0; g[$i]=0; w[$i]=0; echo "Enter Number of Processes:" read n echo "Enter Burst Time:" for (( i=0; i<n; i++ )) do read b[$i] done echo "Enter Arrival Time:" for (( i=0; i<n; i++ )) do read a[$i] done g[0]=0 for (( i=0; i<n; i++ )) do ((w[i]=g[i]-a[i])) ((t[i]=g[i+1]-a[i])) ((awt=awt+w[i])) ((at=at+t[i])) done ((awt=awt/n)) ((at=at/n)) echo " The waiting time is ${w[*]}" echo " The turnaround time is ",${t[*]}" echo " The Average waiting time is $awt" echo " The Average Turnaround time is $at"
- 04-20-2011 #2Linux Newbie
- Join Date
- Apr 2007
- Posts
- 119
You seem to have a rogue quote.
Code:echo " The turnaround time is ",${t[*]}"


Reply With Quote