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

Simple commands

A simple command is a name (understood to be a valid UNIX utility name) together with options and arguments, any input or output redirection, and possibly preceded by variable assignments. Examples we have met in previous chapters include the following.

date

This is just the name of a utility that displays the current time and date.

cat 0< inputfile 1> outputfile

This is a utility with input and output redirected - it copies inputfile to outputfile.

VAR=42 NAME=Chris mycommand argument1 argument2

This utility (mycommand) is run with two arguments and variables VAR and NAME set.


Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck