Topic Reading Homework In-class
1 Introduction and review
 scripting as shell feature
 technical definition of a shell
 shells and processes
 comparison. bash, c shell, korn shell
 exit status
 signals
 files (filesystem, filename structure

Demo
 "Comparative UNIX" on DETER

Slides
 source code patching

 introduction

read Quigley ch 1 "Introduction to UNIX/Linux Shells"

skim ch 2 "Shell Programming QuickStart" showing shell differences through versions of a common script called "the Party Program," adapted for each of the C, bourne, Korn, and bash shells. The script's 4 versions all have the same behavior. Find some of the syntax and code differences.

bash from source to address the shellshock bash bug

 

- source code patching

primitive shells

2

 

Execute-time code precedence

Binary vs script

Interpreter scripts ( #! )

Output (echo, printf)

Slides
 getting started

begin reading Quigley ch 3
"Regular Expressions and Pattern Matching"

begin reading ch 4
"The grep Family"

- comparing shells - The Party Program

 

3

4/16

Interpreter scripts ( #! )

I/O, redirection
 redirection demo scripts .zip

Slides
 getting started (cont'd.)

I/O redirection
refer to, and read/skim these:

Bash Redirections Cheat Sheet
 -with-
Bash One-Liners Explained: All about redirections

I/O redirection

Advanced Bash Scripting Guide chapter 20 "I/O Redirection")


finish reading Quigley ch 3
"Regular Expressions and Pattern Matching"

finish reading ch 4
"The grep Family"

GNU grep manual


begin reading ch 13
"The Interactive Bash Shell"
long, much of it review

I/O redirection programming

precedence of execution

shebang interpreter scripts
 what they do

4

4/23

Regular expressions
 subcontractors : grep, sed

Interactive bash (model quigley 13)
 environment
 command line
 job control
 aliases
 command line expansion
 arrays

Slides
 regular expressions

 interactive bash

finish reading ch 13

examine GNU Bash Reference Manual

topics upcoming
- text tools (based on Robbins & Beebe chs. 3 & 4" read freelance about commands like cut, sort, uniq, fmt, wc, pr, head, tail, strings, dd, file, od/xxd, strings, fold, comm (find the discussions of these that may be found in the textbook, or other resources,e.g. Advanced Bash Scripting Guide section 16.4 "Text Processing Commands")
- sed, in the same category but at larger scale
- regular expressions - more, and more formally
- real scripts, exemplifying particular features (Dave Taylor Wicked Cool Shell Scripts, and Linux Journal "Work the Shell" column; Mendel Cooper Advanced Bash Scripting Guide)

grep exercise

 

shebang interpreter scripts
 how they work

 

 

5

5,6,7
modeled on quigley ch 14

text tools

sed

regular expressions

real scripts
 word frequency analysis
 alphanumeric input validation

Slides

 text processing tools


pipelines

ASCII chart - control characters
 eg ctlZ=dec26=oct032=hex1A

generating binary characters in several products
 documentation per product
 syntax product comparison matrix
 
script that generates them

molly-guard - a "safe remote poweroff" equivalent
 debian package 
 word-origin anecdote


sed resources

textbook ch 5
"sed - the Streamlined Editor"

GNU sed user's manual
(authoritative/comprehensive)

sed.sourceforge.net
(many, many examples)

sed micro primer
(appendix in abs Guide)

safe remote poweroff

arrays for bubble sort

-modify abs word frequency script according to the first item under "Exercises" in the comment block at the bottom of the script. Name your script "wf.sh" and put it in your assignments directory.

word frequency
 abs version
 robbins version

 alphanumeric input validation

 

pipelines to extract data from structured text files
(regular expressions, sed, gawk, cut,sort, join)

6

5/7

sed

regular expressions

Slides

 text processing with sed

 real scripts - backgrounder

Hexdump tools:
od command usage  - to dump files (and other data) in octal (and other) formats

for reference - 3 low-level dump/edit commands
  xxd's documentation
  od's documentation
  bvi's documentation

2 more, for Windows:
 HxD
 XVI32

 

sed one-liners  
one-liners' deeper explanation

turn attention to textbook chapter 14, "Programming the Bash Shell." Some of it will be review. Read particularly parts that are new to you.

Obtain the "datebook" file. Do the exercise at the end of textbook chapter 5. Write sed commands to do each prescribed task. Then, make them available to me by placing each in its own sed (not bash) interpreter script file. That is, if you develop the successful command

sed 's/A/a/g' datebook

put it in the form of a file containing:

#/bin/sed -f
s/A/a/g

Name each of your 10 files according to the question it answers, like q1, q2, etc. If the above responded to question 11 you would name the file "q11" and it should perform correctly when invoked as 

q11 datebook

Make sure all 3 of your file's execute permission bits are turned on.

 

sed successive effects

ways to run sed commands

analyzing sed commands

sed demos from Mark Sobell

7 Programming bash
 arguments
 user input
 validation
 arithmetic
 strings
 flow control

Programming bash (cont'd)
 functions
 signals
 bash options

Slides
 real scripts - backgrounder2

 

parameter expansion (man bash)

textbook ch14 -programming bash

anticipate awk
 - textbook ch 6
 - awk one-liners
 - cheat sheet - awk

textbook ch14

anticipate awk
 (will post reading)

parameter expansion (exercise)

integer input validation

8 More subcontractors :
 awk

Slides
 text processing with awk

The GNU Awk User's Guide

 

awk strings command exercise

dd exercise

extracting classic AWK book's sample scripts

sort multi-line blocks with AWK

AWK one-liners

word frequency again
à la awk
(a-k-w book)
 wordfreq
 

9

5/28

More subcontractors :
 awk; bc

Slides
 real scripts - backgrounder3

GNU bc (precision calculator) manual

bc tutorial examples - phodd.net

Advanced Bash Scripting Guide contains coverage of 
bc, xargs, and find

Read/research about the find command

bc

textbook awk lab 5, p 227, and lab 6, p 255. Next week we will discuss solution. Put the scripts you write into your assignments directory on the server under names lab5.awk and lab6.awk.
get data files

 

Example program - reporting disk hogs

textbook awk lab 3, p 187-88, and lab 4, p 202.
Here are my solutions for lab3 and lab4

bc to perform RSA encryption algorithm

10

6/4

find, locate, xargs

Slides
 subcontractors - bc, xargs, find

GNU Findutils manual find

interesting xargs stuff

 

 

bc exercise

textbook awk lab 5, p 226-27, and lab 76, p 255-56.
Here are my solutions for lab5 and lab6.