Linux Shell Scripting Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

Define a function in the following way:

repeat() 
{ 
  while true 
  do 
    $@ && return 
  done 
}

Alternatively, add this to your shell's rc file for ease of use:

repeat() { while true; do $@ && return; done }