Method to exit a for loop

Hi All,

Can someone let me know how i can exit a for loop without exiting the script itself .... will the break statement work ....

please help ....

-Regards

yes, you can use break.

go through below sample script:

for next_host in $REFERENCE_DBSERVER
do
list_of_database_sids=`s_sid_list $next_host`
for next_sid in $list_of_database_sids
do
connect_strings="$connect_strings @t:$next_host:$next_sid"
break 1
done
done
echo $connect_strings

------------

break exits from a for, select, until, or while loop in a KornShell script. If number is given, break exits from the given number of enclosing loops. The default value of number is 1.