Problem Solving with Shell Scripts
Accelerated Technical Training
for Programmers and Power Users
|
Format
|
- 1 full day
- Emphasis on practical skills.
- Hands-on.
|
Audience
|
- programmers
- software applications developers
- system administrators
- webmasters
- tool builders
|
Overview
|
This course is for Unix users (and users of Unix-like
shells on other systems) who want to increase their
mastery of this powerful repertory of problem-solving
tools and techniques.
Its primary goal is to impart the skills needed to use
advanced features of the Bourne and Korn shells, in particular
their use as a programming language and environment.
A C-Shell-oriented version of this course is also
available.
Shell programming skills enable extraordinary
productivity gains.
Familiarity with the basic concepts of programming
is helpful but not required.
In its method, the course's emphasis is on the practical,
with the majority of the classroom time devoted to hands-on
activity. Attendees largely set their own paces, with the
instructor acting mainly as a facilitator.
Historical and theoretical material is kept to a minimum.
|
Prerequisites
|
- using the window system
-- moving windows, resizing them, opening new ones
- using an editor -- it doesn't have to be
vi
- helpful but not required:
- editing the command line -- a feature of the
Korn shell and the C shell that can save keystrokes
- understanding the purpose and mechanism of a shell
|
Objectives
|
Upon completion of this course, you will be able to
apply many of Unix's advanced commands, including:
grep to search
pr to format
expr to calculate
sed to edit
awk to process records
- various other commands including
date, echo, lp,
ls, man, more, sort,
and wc
- exploit powerful shell features:
- redirection
- command substitution
- inter-process communication (pipes)
- file name generation
- variable substitution
- loops, tests, branches
- create and execute shell scripts
- construct complex commands (options, arguments,
metacharacters)
- match patterns with regular expressions
- perform arithmetic operations
- use Unix's "man page" documentation
- add shell programming to your repertory of
problem-solving techniques
|
Method
|
The course consists of a sequence of examples and
hands-on exercises.
Each builds on the ones before it.
By the end of the course, you have built
solutions to significant problems.
|
Contents
|
- Housekeeping
- review of prerequisites
- course objectives
- related topics
- Why Shell Scripts?
- this is why programmers fall in love with Unix
- similar concepts from other environments
- Review of Prerequisite Topics
- command-line editing
vi
(or emacs
or whatever's preferred)
- Philosophy
- Unix's "building blocks" approach
- silence is golden
- Documentation
- what's in a
man
page
- how they're organized
- why they're effective
man
- Unix's On-Line Manual
- how to use it
- special case: shell built-in commands
- The
ls
Command
- File Name Wildcards
- The
cat
Command
- notions of stdin, stdout, stderr
- The
more
Command
- pagers and how to use them
- The
date
Command
- Output Redirection
- Output Redirection with Append
- The
echo
Command
- surprisingly useful (for
* ,
? ,
$ , etc.)
- Shell Variables
- Command Substitution
- The
wc
Command
- measuring sizes of files
- counting things
- Command Options
- Pipes
- The
pr
Command
- rudimentary formatting
- some special techniques
- The
lp
Command
- The
sort
Command
- Summary of Data Movement Techniques
- moving data between files, streams, variables, devices
- Creating and Running a Shell Script
- the
chmod
command
- the
$PATH
variable
- A Non-Trivial Example
- building a simple bookkeeping system
- The
grep
Command
- extracting text patterns
- regular expressions
- The
sed
Command
- More Regular Expressions
- Shell Script Loops
- shell programming control structures
- Shell Script Arithmetic
- The
awk
Command
- processing fields and records
- Summary
|
Classroom Setup
|
Delivery of this course requires a
classroom equipped with:
- an overhead projector
- a PC or workstation for each student
- connection to the internet
- a workbook for each student
Travel outside the San Francisco Bay Area requires
reimbursement of the instructor's travel expense.
|