|
View Weekly Course Schedule
View Course Resources.
|
Other interesting links: Visit linux.ctyme.com for searchable Linux man pages in HTML format, docs.sum.com for searchable Solaris man pages and other Solaris documentation, Visit the Tampa-St. Pete Linux User's Group (SLUG), which holds meetings on our campus. Most Unix and Linux software is actually GNU software (www.gnu.org), a project of the Free Software Foundation. Download free Unix and Linux distributions from distrowatch.com. Download The PuTTY suite of Internet tools: SSH, scp, sFTP, and others, from www.chiark.greenend.org.uk/~sgtatham/putty. Download the WinSCP GUI wrapper for the PuTTY scp and sFTP tools from sourceforge.net/projects/winscp/. Visit www.unix.org for the OpenGroup's Unix site, including the Single Unix Specification. View Solaris certification and Sun's exam objectives. View Linux LPI certification and View LPI-1 exam objectives. |
| Time & Place: | Ref No. 94817: Monday & Wednesday, 8:20–9:35 PM, Dale Mabry Room DTEC–461 | ||||||
|---|---|---|---|---|---|---|---|
| Instructor: |
Name: Wayne Pollock E-mail: Internet: Office & Phone: DTEC–404, 253–7213. DM Office Hours: Monday–Thursday, 3:55–5:25 & Tues., Thurs. 8:20–8:35; On-line Office Hours: Wednesday–Friday, 12:00 PM (noon)–1:00 PM; or by appointment.
| ||||||
| Text: |
Stephen G. Kochan, Patrick Wood,
Unix Shell Programming,
©2003 Sams Pub.
ISBN: 0-672-32490-3.
Optional: Hahn, Harley, Harley Hahn's Guide to Unix and Linux, ©2009 Harley Hahn, Pub. by McGraw-Hill. ISBN # 978-0-07-313361-4. | ||||||
| Description: |
This course is intended for students who have mastered the basic Linux/Unix
operating environment and who would like to read and understand the various
administrative scripts, and to write scripts to automate day-to-day
tasks.
This course is designed to teach students the skills they need to
effectively read, write and debug shell scripts.
This course explores in detail the Bash shell scripting language.
Major topics covered include reading, writing, modifying, and debugging
shell scripts, the shell environment, regular expressions, text filtering
with grep, sed, and the awk commands,
conditional control statements and loops, interactive scripts, the use of
other shell features such as variables, parameters, argument lists,
shell functions, shell traps.
The basic Unix/Linux environment is taught in the course CTS 1106 (Introduction to Unix / Linux). | ||||||
| Objectives: | The student will demonstrate a knowledge of the following
topics through objective tests, hands-on activities, and/or projects:
| ||||||
| Prerequisites: | CTS 1106, or permission of the instructor. (Students enrolled in a degree or college credit certificate program must complete all prerequisites.) | ||||||
| Facilities: | Assignments must be completed on
YborStudent.hccfl.edu (a Linux server), which can be
accessed from on or off campus using any ssh capable
terminal emulator such as PuTTY.
(Your user ID and password will be provided in
class, along with instructions on how to use this.)
From off-campus you can practice using any Unix/Linux system
available (or install Unix or Linux at home).
You will need your own floppy/flash disk, writing materials,
and three Scantron 882–E or 882–ES forms.
You can use HawkNet
(WebAdvisor) or
FACTS.org to obtain your final grade for the course.
You can use
CampusCrusier
for email, college calendars, and course (and college related)
resources.
HCC DM Open Lab Computers are located in the computer science department open lab in DTEC–462. Lab hours are:
| ||||||
| Grading: |
Grading scale:
A=90-100, B=80-89, C=70-79, D=65-69,
F=0-64 | ||||||
| Policies: |
| ||||||
| Projects: |
Projects will be assigned from the class web page
at various times.
You will have sufficient of time to complete the projects,
at least a week but usually two weeks.
Although there may be some in-class group exercises,
you must work individually on the projects,
typically outside of regular class hours.
Projects are graded on the following scale:
A = 95% (Excellent:
Good design with good comments, style, and extras) Minor extras worth +5 points, minor omissions or poor design worth -5. Projects are not graded when turned in. They are graded all at once, sometime after the project deadline has passed (usually the next weekend). Every effort will be make to grade projects within a week of the due date, or as soon thereafter as possible. Further details will be provided with your first project. (See also submitting assignments below.) | ||||||
| Submitting Assignments: |
In general you won't need to submit projects.
Sometime after the due date I will examine your files
in your home directory on YborStudent.
(DO NOT remove group read or execute permissions
from your files and directories or I won't be able to grade your
work!)
Other assignments should be submitted by email to
.
Please use a subject such as In the event a student submits more than once for the same assignment, I will ignore all but the last one received up to the deadline. Assignments submitted after the deadline will not count toward your grade except as allowed by the course late policy.
The HCC email server automatically accepts and
silently discards email with certain types of attachments.
If you must send email to my Internet (non-YborStudent) email
account please avoid using any attachments, but especially
To avoid having your submitted work rejected as
If you have an email problem you may turn in a printout instead.
Be sure your name is clearly written on the top of any pages
turned in.
Please staple multiple pages together (at the upper left). |
| Classes Begin: | Monday 1/11/10 (First class meeting: Monday 1/11/10) |
|---|---|
| Add-Drop Ends: | Friday 1/15/10 |
| Last Day to Withdraw: | Thursday 3/18/10 |
| Classes End: | Monday 5/10/10 (Last regularly scheduled class: Monday 5/10/10) |
| Grades Available: | Thursday 5/13/10 (from FACTS.org or HawkNet) |
| HCC is closed on: |
Monday 1/18/10 (Martin Luther King Day), Monday 2/15/10 (Presidents' Day), Friday–Sunday 3/26/10–4/4/10 (Midterm Break), Thursday 4/15/10 (In-Service Day) |
If, to participate in this course, you require an accommodation due to a physical disability or learning impairment, you must contact the Office of Services to Students with Disabilities, Dale Mabry campus: Student Services Building (DSTU) Room 204, voice phone: (813) 259–6035, TTD: (813) 253–7035, FAX: (813) 253–7336. Brandon campus: voice phone: (813) 253–7914.
HCC has a religious observance policy that accommodates the religious observance, practices, and beliefs of students. Should students need to miss class or postpone examinations and assignments due to religious observances, they must notify their instructor at least one week prior to a religious observance.
| Quotes: | Tell me and I'll listen. | — Lakota Indian saying | |
|---|---|---|---|
Learning is not a spectator sport! | — Chickering & Gamson |
| Dates
Mon Wed |
Topics and Assigned Readings |
|---|---|
| 1/11 |
Course introduction.
Assign User IDs for LAN and Unix systems,
discuss passwords.
Basic procedures: ssh, login/logout.
Open Lab procedures and hours, Role of lab techs.
Overview of Unix and Linux operating systems and concepts.
User roles (user/operator, administrator, programmer/developer).
File, directory, and pathname concept review. Review basic commands: cd, pwd, pathchk,
mkdir, rmdir,
passwd, cp, mv,
rm, ln, ls -laRd,
who, echo, cat,
more and less,
tac and rev.
Useful non-standard utilities include:
pwgen and apg,
script and screen,
and readlink.
Using man, info, and other resources.
Readings: Chapters 1, 2 (pages 5–24) |
| 1/13 |
The vi/vim (and other) text editor.
Readings: online vi/vim resources |
| 1/18 | Martin Luther King Jr. Day — HCC closed |
|
1/20
1/25
|
Shell features (part 1): globbing (wildcards),
locales
(I18N),
I/O redirection, pipelines.
Understanding processes.
Project 1 due: 1/20 Readings: Chapters 2 (pages 24–38), 3, pages 327-339, 352-360 |
|
1/27
2/1 2/3
|
Regular Expressions
(BREs,
EREs,
PREs,
and POSIX).
Some common filter commands:
sed, cut, paste,
tr, wc, grep,
sort, uniq,
od and xxd, strings,
diff (and cmp, vimdiff
sdiff, comm, and patch),
and XML utilities (xmlgrep,
xmldiff, and others).
Readings: Chapter 4, on-line regular expression resources |
| 2/8 2/10 |
Using awk to simplify data processing and
report generation.
Project 2 due: 2/8 Readings: on-line AWK resources |
| 2/15 | Presidents' Day — HCC closed |
| 2/17 | Exam #1 |
| 2/22 2/24 |
Perl basics and one liners. Using cpan.
Additional useful commands:
find, file, tee,
xargs, expect,
and sendmail/mail/mailx.
Readings: on-line Perl resources, find command resources, xargs, expect (and Tcl/Tk) command resources |
|
3/1 3/3
3/8 3/10 |
Command line processing steps (input, tokenizing, parsing,
various expansions, command substitution, arithmetic expansion,
field splitting, quote removal, I/O
redirections).
tilde substitution, quoting, aliases.
Interactive (login) shell use: login scripts, the environment, history, auto-completion, job control, using nohup,
restricted shell.
using shell variables, shell built-in commands.
Shell scripting concepts and features: environment variables, Permissions, PATH,
comments, she-bang line, sourcing scripts,
shell arithmetic, expr, and bc.
Command substitution.
Project 3 (filters) due: 3/8 Readings: Chapters 5, 6, pages 326, 342-343, on-line permissions and octal number reference, on-line command line processing resources |
| 3/15 |
Positional and other special parameters.
shift, debugging scripts using
set -x.
Exit status, $?.
Project 4 (awk) due: 3/15 Readings: Chapters 7, 8 (pages 145–149) |
| 3/17 |
Using if statements and the test
command, the && and
|| operators.
The exit command.
Using case statements
(and bash extended pattern-matching).
Readings: Chapter 8 |
| 3/22 3/24 |
Using loops: while, until,
and for loops.
Using break and continue.
Parsing the command line with getopts.
Using seq (Linux only).
Readings: Chapter 9 |
| 3/26–4/4 | Mid-Term Break — HCC closed |
| 4/5 | Exam #2 |
| 4/7 |
Using read for interactive shell scripts.
echo and printf.
Creating TUI
menu-driven scripts (mention select loops/menus).
Temporary files.
Readings: Chapter 10, on-line resources for temporary files |
| 4/12 |
More on the environment, sub-shells, command grouping.
Sourcing scripts.
Advanced variable (parameter) use.
The set, unset,
and bash shopt commands.
Project 5 (parse access log) due: 4/5 This is extra credit (optional) project now: Project 6 (Perl) due: 4/5 Readings: Chapters 11, 12 |
|
4/14
4/12 4/14
|
Using signals: kill and trap commands.
eval, wait, here documents
(in-line input redirection) and shell archive files,
advanced I/O redirection techniques.
Using named pipes.
File locking: advisory versus mandatory, shared versus exclusive;
using flock.
Creating and using shell functions and aliases.
(Optional: Working with shell arrays, lists.)
Project 7 (find) due: 4/14 Readings: Chapter 13, 15, on-line resources for named pipes |
| 4/19 4/21 |
Customizing output with tput.
Creating progress bars.
Using stty to control input.
Using crontab and at.
Creating man pages for your scripts.
Readings: on-line resources TBD |
| 4/26 4/28 |
Optional (time and interest permitting):
Using readline.
Using the Linux dialog command to add a
GUI to scripts.
Using scripts for Website support, management,
and web page generation (MRTG scripts).
Using MySQL, PostgreSQL
databases with shell scripts.
Validating data.
Using tar, gzip, rsync
to create backup scripts.
Using RCS (Revision Control System).
Readings: on-line resources TBD |
| 5/10 |
Exam #3
Project 8 (getopts) due: 5/10 |
| Resources | |||||
|---|---|---|---|---|---|
| PuTTY home | Recommended Windows SSH client | Copy and Paste Help | How to use PuTTY's copy and Paste. | ||
| Csh Programming Considered Harmful | A famous article from Tom Christiansen posted in 1996 | Soft Skills | Information about Soft Skills, Professional affiliations and certifications, and job hunting and interviewing tips. | ||
| www.unix.org | The OpenGroup's Unix site, include the Single Unix Specification. | comp.unix.shell newsgroup | An active discussion netnews group; you can post questions here and get anwsers | ||
| Linux Standard Base (LSB) | Standard tools, DLLs, etc., common to all Linux distros. Current spec maintained by The Linux Foundation. | Single Unix Specification | The current Unix reference, including for the shell and utilities | ||
| docs.sun.com | Solaris man pages, administrator guides, and more | linux.ctyme.com | Searchable Linux man pages in HTML format | ||
| Vi lovers home | Tutorials, FAQs, and references for vi. | vim home | Home page for VIM (Vi, IMproved) | ||
| Vim documentation project | Tutorials, FAQs, and references for vim. | vim quick reference (PDF) | A two-page reference to vim | ||
| Regular Expressions | Shows Regular Expression (regex) syntax. |
RegularExpression.jar | Download Regular Expression Lab (a Java program). (See also Java Regular Expression syntax summary.) | ||
| www.regular-expressions.info | On-line tutorial and reference for regular expressions | regexlib.com | On-line cookbook (library) of standard regular expressions | ||
| regular expression cartoon | The importance of learning regular expressions | ||||
| Command Line Processing | The steps the shell performs when parsing input. | Variables, Control Structures, and Funtions | A mini-tutorial for non-programmers. | ||
| Gnu AWK User Guide | A tutorial and reference manual for Gnu AWK. | AWK FAQ | AWK Frequently Asked Questions | ||
| AWK Overview | A copy of my lecture notes for AWK | POSIX AWK Reference and description | The AWK man page from The Open Group POSIX document SUSv4 | ||
A find tutorial |
A short tutorial, with examples | find command tip | Shows how to use find to locate files modified
by an administration tool. |
||
An xargs tutorial |
From www.unixreview.com. | Shell Scripting Introduction | Shows the basics of shell scripting. | ||
An expect tutorial |
From the O'Reilly book Exploring Expect. | Tcl tutorial | Shows the basics of Tcl scripting. (See also Tk tutorial.) | ||
A perl tutorial |
A short tutorial, with examples (work in progress) | CPAN | Comprehensive Perl Archive Network | ||
| learn.perl.org | Perl tutorials from Perl.org | Beginning Perl | An on-line book for learning Perl | ||
| PerlMonks.org tutorials | Another site with Perl resources | Perl.com | A portal for all things Perl | ||
| PerlMeme.org tutorials | Good site with Perl resources | Here docuements | A description of Perl here documents | ||
| Octal Number Chart | Shows how to use octal numbers with chmod and
umask. |
Filesystem Hierarchy Standard | A description of the standard directories on Linux
(for Unix systems, see also man filesystem) |
||
| Using temporary files, trap | How to create, use, and clean up temporary files using trap | Using named pipes | How to use named pipes (a.k.a. FIFOs) | ||
| flock-demo | A script showing advisory file locking with
flock |
timestamp.sh | A POSIX script to display Unix Time (See also timestamp.c) | ||
| crontab reference | Shows crontab file syntax. | at command syntax | Some at samples of entering times and dates,
and other info. |
||
| StartupScript.txt | Sample startup shell scripts (/etc/init.d/foo) for a foo server. | System V init files | From /usr/share/doc/initscripts-7.42.2 on Fedora. | ||
| RCS Demo | A sample session using RCS with a shell script | ||||
| Shell Scripts (and Other Demos) | |||||
| LDP: Bash scripting guide and reference) | Shows how to write Bash shell scripts. complete Bash man page | SSC's Bash shell reference card | (Posted here by permission of SSC, Inc.) | ||
| fancyio | Shows how to write interactive shell scripts. | fortune | A fortune cookie script (plus some sample fortunes) | ||
| nusers | Shows a simple shell script. | nusers.1 | Sample man page for nusers, using troff/man macros. | ||
| getopts Demo | A demo of the POSIX getopts utility |
getopt Demo | A demo of the Gnu getopt utility |
||
| backup-etc.sh | A simple shell script to backup /etc directory. | httpd.sh | Apache script for use in rc.d/init.d. | ||
| .bashrc | Some useful bash shell aliases and functions. | .bash_profile | A simple Bash login script. | ||
| .procmailrc | A sample .procmailrc that auto-replies and filters spam. | add-users | A complex script used to add users in batches. | ||
| todo | A simple "todo list" shell script. | didit | Simple shell script, used with "todo" script. | ||
| didit2 | Shell script, used with "todo" script. | didit3 | Fancy shell script, used with "todo" script. | ||
| pick | interactive selection script. | watch | Shows how to write shell and awk scripts. | ||
| suidDemo.tgz | Shows how suid can be used to control access to files. | Sample .vimrc | A basic ~/.vimrc file | ||
| exec Demo | A demo using exec to emulate BASIC's READ and DATA statements | find-IP | A script to locate files in /etc containing the host's IP address | ||
| sttydemo.sh | A script using stty for fancy I/O | find-dups.sh | A highly portable script that shows many advanced techniques, that finds duplicate files by comparing MD5 checksums | ||
| Perl CGI (Database) Scripts | |||||
| filter.pl | Model Perl script to ask as a standard *nix filter. | hellotk.pl | A Perl/Tk GUI script (Hello, World). | ||
| HccDump | The SQL statements needed to create the HCC MySQL database. | graphics.tgz | The gzipped tar file containing the sample gif files for the hcc.com postcard system. (Unpack in the directory: DocumentRoot/graphics) | ||
| send-postcard.pl | Perl script to send an e-card; uses CGI and DBI (DB access). | show-postcard.pl | Perl script to retrieve an e-card; uses CGI and DBI. | ||