根据函数的输出休眠 while 循环

sleep a while loop based on output from a function

在以下方面需要您的帮助。我的.sh如下。

 getfunc (){

 if [condition 1]
 then
 echo "NOK" >flag
 else
 echo "OK" >flag
 fi
 }

 while IFS=" " read -r var1
 do
 getfunc
 if [ $flag -eq OK ]
 then
 "print 1"
 else 
 "sleep for sometime"
 fi
 done <file

我不知道如何告诉 while 继续定期尝试,直到它从 getfunc 得到 OK。

非常感谢任何帮助。谢谢。

  until [[condition]]
  do
  echo "sleeping"
  sleep 5
  done