Foothill CollegeApproved Course Outlines

Physical Sciences, Mathematics & Engineering Division
4 hours lecture, 3 hours laboratory.5 Units

Total Quarter Learning Hours: 84 (Total of All Lecture, Lecture/Lab, and Lab hours X 12)
 Lecture Hours: 4 Lab Hours: 3 Lecture/Lab:
 Note: If Lab hours are specified, see item 10. Lab Content below.

Repeatability -
Statement: Not Repeatable.

Status -
 Course Status: ActiveGrading: Letter Grade with P/NP option
 Degree Status: ApplicableCredit Status: Credit
 Degree or Certificate Requirement: AS Degree
 GE Status: Non-GE

Articulation Office Information -
 Transferability: BothValidation: 11/14/12

1. Description -
Linux shell script programming using the Bourne Again shell programming language (bash) and UNIX utilities to create practical shell scripts. Topics covered include customizing the environment, running and writing scripts, variables, loops, functions, text processing and debugging.
Prerequisite: C S 30A or equivalent.
Co-requisite: None
Advisory: None

2. Course Objectives -
The student will be able to:
  1. Describe the history, purpose and components of a UNIX shell.
  2. Create a user account, logon and get information using commands on a UNIX system.
  3. Understand and customize the bash shell environment by creating aliases and altering environment files.
  4. Use a UNIX text editor to create a shell script and run scripts effectively from the command line.
  5. Write code to redirect input and output to and from the user, files and commands using redirection and pipes.
  6. Incorporate essential UNIX utilities such as eval, exec, exit and sleep in a program.
  7. Describe the different types of variables in the bash environment and explain the properties and uses of each.
  8. Define, analyze and code the basic conditional and iterative control structures and explain how they can be nested.
  9. Design, implement, test, and debug functions that can be used in scripts, and demonstrate the way parameters are passed in such functions.
  10. Declare and initialize an array, then access and sort the array elements.
  11. Use regular expressions and bash commands to write code to process text including finding, sorting, comparing and merging.
  12. Use advanced regular expressions as well as the sed and awk utilities to perform more advanced text manipulation.
  13. Describe methods for handling and using processes, jobs, signals, coroutines, and subshells.
  14. Implement code to appropriately handle errors and provide meaningful feedback via exit status and error messages.
  15. Use a variety of techniques such as debug functions, debug statements and built in debugging options to find and fix code errors.
3. Special Facilities and/or Equipment -
  1. Access to a computer laboratory with the Linux operating system.
  2. A website or course management system with an assignment posting component (through which all lab assignments are to be submitted) and a forum component (where students can discuss course material and receive help from the instructor). This applies to all sections, including on-campus (i.e., face-to-face) offerings.
  3. When taught via Foothill Global Access on the Internet, the college will provide a fully functional and maintained course management system through which the instructor and students can interact.
  4. When taught via Foothill Global Access on the Internet, students must have currently existing e-mail accounts and ongoing access to computers with internet capabilities.

4. Course Content (Body of knowledge) -
  1. Shell Basics
    1. Purpose of a shell
    2. History of UNIX shells
    3. Components of UNIX
    4. The kernel and subsystems
  2. Getting started with UNIX
    1. How to login and logout
    2. User accounts
    3. The superuser
    4. Account settings and configuration
    5. Commands for getting information
    6. Stopping a program
  3. Customizing the Environment
    1. .bash_profile file
    2. .bash_logout file
    3. .bashrc file
    4. Aliases
    5. Shell prompt
  4. Writing and running scripts
    1. Text editors
    2. Understanding man pages
    3. Command line syntax
    4. Arguments and options
    5. Command line history
    6. Command line completion
    7. Command line editing
  5. Input / Output
    1. Standard input
    2. Standard output and Standard error
    3. Redirection
    4. Pipes
  6. Essential utilities/commands
    1. echo and print
    2. exit
    3. exec
    4. eval
    5. sleep
  7. Variables
    1. Bash reserved variables
    2. Typed variables
    3. Integer variables and arithmetic
    4. String variables and quoting
    5. Variable scope
    6. Exporting variables
  8. Program Control
    1. Logical operators
    2. Test command
    3. if/else
    4. for
    5. case
    6. select
    7. while/until
  9. Functions and argument passing
    1. Writing functions
    2. Calling functions
    3. Positional parameters
    4. Processing options
  10. Arrays
    1. Properties
    2. Operations
    3. Sorting
  11. Text Processing Commands
    1. Selecting using grep
    2. Basic regular expressions
    3. Sorting input
    4. Finding files
    5. Merging lines
    6. Comparing files
    7. Eliminating duplicate lines
  12. Advanced Text Manipulation
    1. awk
    2. sed
    3. Advanced regular expressions
  13. Process Handling
    1. Process IDs and job numbers
    2. Job control
    3. Signals
    4. Coroutines
    5. Subshells
    6. Process substitution
  14. Exit and Signal handling
    1. Signal trapping
    2. Exit status
    3. Error messages
  15. Debugging Techniques
    1. Syntax vs. logic errors
    2. Echo commands
    3. Set built in debugging options
    4. Debug statements
    5. Debug functions
    6. Repeatability - Moved to header area.
5. Repeatability - Moved to header area.
6. Methods of Evaluation -
  1. Tests and quizzes
  2. Written laboratory assignments which include source code, sample runs and documentation.
  3. Final examination
7. Representative Text(s) -
Cameron Newham, Learning the bash Shell: Unix Shell Programming, O'Reilly, 2010
Quigley, Ellie, Linux Shells by Example, Fourth Edition, Prentice Hall, 2005, ISBN: 013147572x
Tansley, David, Linux and UNIX Shell Programming, Addison Wesley, 2001.
Robbins, Arnold, Michael Brennan, Effective awk Programming, 3rd Edition, O'Reilly & Associates, Inc., 2001.
Aho, Alfred V., Brian W Kernighan, Peter J Weinberger, The AWK Programming Language, third edition, Addison-Wesley, 1999.

8. Disciplines -
Computer Science
9. Method of Instruction -
  1. Lectures which include motivation for syntax and use of shell programming language and shell scripting concepts, example programs, and analysis of these programs.
  2. On-line labs (for all sections, including those meeting face-to-face/on campus) consisting of
    1. An assignment web-page located on a college-hosted course management system or other department-approved Internet environment. Here, the students will review the specification of each lab assignment and submit their completed lab work.
    2. A discussion web-page located on a college hosted course management system or other department-approved Internet environment. Here, students can request assistance from the instructor and interact publicly with other class members.
  3. Detailed review of written assignments which includes model solutions and specific comments on the student submissions.
  4. In person or on-line discussion which engages students and instructor in an ongoing dialog pertaining to all aspects of designing, implementing and analyzing shell scripts.
  5. When course is taught fully on-line:
    1. Instructor-authored lecture materials, handouts, syllabus, assignments, tests, and other relevant course material will be delivered through a college hosted course management system or other department-approved Internet environment.
    2. Additional instructional guidelines for this course are listed in the attached addendum of CS department on-line practices.
10. Lab Content -
  1. Getting started with UNIX
    1. Create a new user account with user id and password.
    2. Enter commands such as whois, which and whereis to get basic information.
    3. Run and stop programs from the command line.
    4. Customize the environment by altering key system files.
  2. Writing and running scripts
    1. Demonstrate the complete edit-debug-run cycle of a script using a text editor and the command-line environment.
    2. Use command line arguments and options to run the script.
    3. Distinguish between syntax errors and logic errors and develop strategies for dealing with each type of error.
    4. Debug code with the help of error messages and functions to produce a working program.
  3. Exploring the different variable types through system and user-written files
    1. Gain experience in effectively using the text editor to create code with numeric types.
    2. Gain experience in effectively using the text editor to create code with string types.
    3. Use the text editor to assist in assigning new values to bash environment and reserved variables.
    4. Solve syntax and logic problems that arise from typical incorrect use of variables whether pre-defined or user-defined.
  4. Demonstrating interaction with the user, files and commands
    1. Use pipes and redirection to interact with files or other commands.
    2. Play the role of user and programmer, alternately, to establish a user-interaction plan for a program.
    3. Evaluate and comment on other students' user-interaction plan.
    4. Change modes from source code design (editing mode) to end-user interaction (run mode) in your IDE in order to perform Q/A on the program.
    5. Fix poor interaction behavior by adjusting code and rerunning program until a satisfactory result is achieved.
  5. Building a script that demonstrates “intelligence” though a combination of control statements
    1. Become familiar with selection, loop and nesting to imbue code with correct logic behavior.
    2. Use structured programming to make control structures maintainable.
    3. Run the program multiple times to verify that its control statements produce the correct behavior or output under any scenario.
    4. Fix incorrect logic behavior by adjusting control structures and rerunning program until a satisfactory result is achieved.
  6. Incorporating functions and utilities in programming projects
    1. Gain experience in writing a function.
    2. Use a previously written function/utility in a client program.
    3. Refine functions by adding or changing their definitions and observe the result.
    4. Use positional parameters and processing options to change the outcome of running a function.
    5. Deduce the impact of a function's or utility's design on the programs that invoke it.
  7. Processing and manipulating text.
    1. Use commands, regular expressions, and utilities such as sed and awk to process and manipulate text.
    2. Use the man pages to understand the purpose and use of various text processing commands.
    3. Use debugging techniques to successfully integrate awk and sed functions into user written code.
  8. Handling processes
    1. Use a text editor to write code involving both system and user processes.
    2. Incorporate commands to control jobs, handle signals, run coroutines and start child processes.
    3. Show results by using commands to print information on processes.
    4. Use debugging techniques to solve problems that arise during the testing of the program.
11. Honors Description - No longer used. Integrated into main description section.
12. Types and/or Examples of Required Reading, Writing and Outside of Class Assignments -
  1. Reading
    1. Textbook assigned reading averaging 30 pages per week.
    2. Reading the supplied handouts and modules averaging 10 pages per week.
    3. Reading on-line resources as directed by instructor though links pertinent to bash shell scripting.
    4. Reading library and reference material directed by instructor through course handouts.
  2. Writing
    1. Writing technical prose documentation that supports and describes the programs that are submitted for grades.
13. Need/Justification -
This course is a restricted support course for the AS degree in Computer Science.

Course status: Active
Last updated: 2014-03-11 13:50:15

Foothill CollegeApproved Course Outlines