Home arrow Shell Programming arrow Write a While loop in Shell Scripting Language
Write a While loop in Shell Scripting Language PDF
Saturday, 23 January 2010

See next example to learn how to write a while loop in UNIX Shell scripting language:

Example of a While loop
  1. #!/bin/sh
  2.  
  3. e=0
  4.  
  5. while [ "$e" -ne 1 ]
  6. do
  7.         echo "while loop"
  8.         e=1                # exit condition
  9. done


Don't forget to define e variable from evaluation section of the while loop, otherwise the script will not run.

 
< Prev   Next >

Other BSD Systems

OpenBSD

Misc

Solaris

Polls

Best BSD firewall?