Problem-Solving with Shell Scripts

Accelerated Technical Training

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. Shell programming skills enable extraordinary productivity gains.

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.

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.

Format

  • One full day
  • Emphasis on practical skills
  • Hands-on

Audience

  • Programmers
  • Software applications developers
  • System administrators
  • Webmasters
  • Power users
  • Tool builders
  • Prerequisites

    Check the ones your background satisfies:
    Using a computer, including its window system and file system
    Using a text editor -- it doesn't have to be vi
    If you checked 2 or more, you're well-equipped to take this class.

    Contents

    Why Shell Scripts?

    • This is why programmers fall in love with Unix
    • Similar concepts from other environments

    Productivity Skills

    • Command-line editing
    • Text editing

    Philosophy

    • Unix's "building blocks" approach
    • Silence is golden

    Documentation

    • What's in a man page
    • How they're organized
    • Why they're effective
    • How to use them
    • Special case: shell built-in commands

    File Names and I/O

    • The ls command and its options
    • File name wildcards: * and ?
    • The cat command
    • Notions of stdin, stdout, stderr
    • The more command
    • The date command

    Redirection

    • Output Redirection
    • Output Redirection with Append
    • The echo command

    Shell Variables

      Command Substitution

      • The wc command
      • Command Options

      Unix Plumbing

      • Pipes
      • The pr command
      • The lp command
      • The sort command
      • Moving data between files, streams, variables, devices

      Creating and Running a Shell Script

      • The chmod command
      • The $PATH variable

      Processing Text

      • Building a simple bookkeeping system
      • The grep command
      • Extracting text patterns
      • The sed command
      • Stream editing

      Regular Expressions

        Shell Programming Control Structures

        • Loops
        • Arithmetic
        • The expr command
        • The awk command
        • Processing fields and records

        Summary

            Objectives

            Upon completion of this course, you will be able to:
            • Use grep to search text
            • Use pr to format text
            • Use expr for calculations
            • Use sed to edit text streams
            • Use wc to count and measure
            • Use awk to process records
            • Use various other commands including date, echo, lp, ls, man, more, sort, and wc
            • Exploit powerful shell features: i/o redirection, command substitution, inter-process communication (pipes), file name generation, variable substitution, loops, tests, and 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.

            Setup

            Delivery of this class requires:
            • Classroom
            • Overhead projector
            • A PC or workstation for each student
            • Connection to the internet
            • A workbook for each student
            • Detailed system configuration instructions are available at
            Write to us! webmaster@keller.com
            http://dan-keller.com/training/curric/xml-versions/shprog.html
            Updated Wednesday, 31-Oct-2001 13:18:38 MST

            Copyright © DKTS
            Dan Keller Technical Services
            4500 19th St., San Francisco
            California, USA 94114
            voice: 415 / 861-4500