1. Introduction

    System Information

  2. Inter-Process Communication
  3. Signals

    Programming in Various Environments

  4. Script Programming
    1. Script Variables
    2. Test Conditions
    3. Control and Iteration
    4. Commonly used Programs
    5. Shell Capabilities
    6. Example looping script
    7. Example using Variables
    8. Example working with files
    9. Example install script
  5. C and C++ Programming
    1. POSIX System Capabilities
    2. More POSIX
    3. Threads
    4. Mutexes
    5. An example viewmod program
    6. An example serial program
  6. X Programming
  7. Debugging
  8. Credits

An example looping script

The file below is an example file which demonstrates some of the testing as talked above along with several looping and control statements.

#! /bin/bash	
# Use the bash shell to run the script
# This is an example file to take entries from the user
# entries Version 1.0 May 22, 2000
DONE=no
ENTRIES="hello bye ls 1"
while [ $DONE = no ]
do
   echo Valid entries are: $ENTRIES
   read ENTRY             # Read the variable ENTRY from the user
   case $ENTRY in
   1)
       pwd
       ;;
   hello)
       echo How are you?
       ;;
   bye)
       echo exiting...
       DONE=yes
       ;;
   ls)
       ls -al |more
       ;;
   *)
       echo $ENTRY is an unrecognized command.
       ;;
   esac
done