Main index

Introducing UNIX and Linux


Introduction to shells

Overview
Why do we need a shell?
Shell syntax
      Types of shell command
      Simple commands
      Pipelines
      Grouping commands
      Exit status
      List commands
Arithmetic
      Operators and functions
Making decisions
      The 'test' statement
            Operators used by 'test'
      The 'if' statement
Loops
      'For' loops
      'While' and 'until' loops
Searching for files
      Arguments to 'find'
Formatted output
      Arguments to 'printf'
Passing information to scripts
      Scripts with arguments
      Parameter expansion
Summary
Exercises

Loops

It is often necessary to execute part of a script multiple times. This can be done either a given number of times, or whilst a given condition is met. This construct is known as a loop, and exists in some form in all programming languages. There are two basic type of loop which the shell supports.


Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck