title: sleep a while loop based on output from a function
body: <p>Need your help with the following. My .sh is as follows.</p>
  
  <pre><code> getfunc (){
  
   if [condition 1]
   then
   echo "NOK" &gt;flag
   else
   echo "OK" &gt;flag
   fi
   }
  
   while IFS=" " read -r var1
   do
   getfunc
   if [ $flag -eq OK ]
   then
   "print 1"
   else 
   "sleep for sometime"
   fi
   done &lt;file
  </code></pre>
  
  <p>I don't know how to tell while to keep trying in regular intervals, till it gets OK from getfunc.</p>
  
  <p>Any help is greatly appreciated. thanks.</p>