The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 09-09-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,128
There is a "true" command that does nothing except set the exit code. So you could do:

while true ; do
done

to have an infinite loop. The bourne shell also has a ":" command that does nothing. It is built-in to the shell so it is faster that "true" which is external. So a second option is:

while : ; do
done

The syntax looks weird, but this is used a lot in sh scripts.