MySQL Forums
Forum List  »  Newbie

Re: Shell Script to Insert rows in loop
Posted by: Jon Stephens
Date: July 15, 2016 04:04AM

*Everything* inside a while executes when the test condition evaluates as true. When the test condition evaluates as false, *nothing* inside the while executes. It's one or the other. I don't think you've stated your objective as clearly as you might, but--if you want execution of the for loop to terminate prematurely inside the while, you'll need to perform the test inside the for loop and, if it fails, explicitly break out of the for loop at that point.

This might be helpful:

Flow Control: break and continue

Another approach might be to test for both conditions in the while (and not bother with the for).

cheers,

Jon Stephens
MySQL Documentation Team @ Oracle

MySQL Dev Zone
MySQL Server Documentation
Oracle

Options: ReplyQuote


Subject
Written By
Posted
Re: Shell Script to Insert rows in loop
July 15, 2016 04:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.