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

Overview

This chapter

  • explains why a shell is needed; and
  • introduces simple syntax for the shell, including conditional statements and loops.

In previous chapters, we have considered UNIX commands together with related concepts such as process and environment. In this chapter we consider the shell - the command interpreter - in more detail, and introduce the constructs that are a part of the shell and make it a programming language in its own right.


Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck