How to use GOTO stmt in Unix scripting?

my code does somthing like this:

#!bin/ksh
sqlplus / | While read id
do
     temp=`echo $id`
     i = i+1
done
j=0
while [ $j -le $i ]
do
     --connecting to sql and executing a Stored proc for 1st id
     --checking for the status 
     status = $?
     if [$status -ne 0]
          error
          --need to increment j and go to WHILE LOOP ------------How To GOTO while loop from this step and nees to execute Stored Proc for 2nd id and so onn
     else
          --some other steps need to be executed
done

please help!!.....

What you want sounds like continue. That will jump it back up to the top of the while loop and execute its conditional statement again.

1 Like