how to goto in ksh

Hi,
I'm trying to use the goto in ksh but it does not appear to be a valid command. Is that only valid in csh? Anything similar in ksh that I can use?

Appreciate any help you can provide.

Thanks.

geraldine

No goto in ksh. You will need to use structured programming.

Hi,
can someone shed some light on how I can write my own goto statement. I know it's generally not a good idea to use goto but in this circumstances, I think goto would be efficient.

I have a driver script (driverjob.sh) that calls several jobs, eg.

job1
job2
job3
job4
job5

if job3 fails, the driver script will write the name of the job to a log file and stop executing. After the error in job3 is fixed, if I rerun driverjob.sh, I would like the driver script to read from the log file the name of the failed job and process job3 onwards, thus bypassing job1 and job2.
If there is no goto command, the only way I can think of is to use if then else statement and check the status of each job.

Any suggestions?

thanks.

geraldine

Try something like:

[[ -f $LOGFILE ]] && read lastjob <$LOGFILE
for xjob in job1 job2 job3 job4 job5 job6 ; do
       if [[ -z $lastjob || $lastjob = $xjob ]] ; then
            ./$xjob || {echo $xjob > $LOGFILE ; exit 1 ; }
       fi
done

Thanks! That works. I just had to make slight modification to your original script.

thanks again.