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 Slides |
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 |
2
|
Execute-time code precedence Binary vs script Interpreter scripts ( #! ) Output (echo, printf) Slides |
begin reading Quigley ch 3 "Regular Expressions and Pattern Matching" begin reading ch 4 |
- | comparing
shells - The Party Program
|
3
4/16 |
Interpreter scripts ( #! )
I/O, redirection Slides |
I/O redirection Bash
Redirections Cheat Sheet Advanced Bash Scripting Guide chapter 20 "I/O Redirection")
finish reading ch 4
|
shebang
interpreter scripts |
|
4
4/23 |
Regular expressions Interactive bash (model quigley 13) Slides |
finish reading ch 13
examine GNU Bash Reference Manual topics upcoming |
grep exercise
|
shebang
interpreter scripts
|
5
5,6,7 |
text tools
sed regular expressions real scripts Slides
|
ASCII chart - control
characters eg ctlZ=dec26=oct032=hex1A generating binary characters in several
products molly-guard
- a "safe remote poweroff" equivalent
textbook ch 5 GNU
sed user's manual sed.sourceforge.net sed micro primer |
safe
remote poweroff
-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
pipelines
to extract data from structured text files |
6
5/7 |
sed
regular expressions Slides |
Hexdump tools:
for reference - 3 low-level dump/edit commands
2 more, for Windows:
sed
one-liners 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 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. |
|
7 | Programming bash arguments user input validation arithmetic strings flow control Programming bash (cont'd) Slides
|
parameter
expansion (man bash)
textbook ch14 -programming bash anticipate awk |
textbook ch14
anticipate awk |
parameter expansion (exercise) |
8 | More subcontractors : awk Slides |
The
GNU Awk User's Guide
|
awk | strings command
exercise
extracting classic AWK book's sample scripts sort multi-line blocks with AWK word frequency again |
9
5/28 |
More subcontractors : awk; bc Slides |
GNU
bc (precision calculator) manual
bc tutorial examples - phodd.net Advanced Bash Scripting Guide contains coverage of Read/research about the find command |
bc textbook awk lab 5, p 227
|
Example program - reporting disk hogs textbook awk lab 3, p 187-88, and lab 4, p 202. |
10
6/4 |
find, locate, xargs | GNU Findutils manual | find
|
textbook awk lab 5, p 226-27, and lab 76, p
255-56. |