CE5011: Shell and Perl Programming 1

School Continuing and Professional Education
Department Code LEARN
Module Code CE5011
External Subject Code 100956
Number of Credits 20
Level L5
Language of Delivery English
Module Leader Dr Edward Evans
Semester Autumn Semester
Academic Year 2014/5

Outline Description of Module

This course will provide an introduction to the UNIX operating system, the use of the awk scripts, shell scripts and Perl scripts to process text data.  Topics covered in the introduction the UNIX operating system include a discussion of the file hierarchy, the use of essential file and directory commands, and, finally, file and directory access.  Topics covered in the shell scripting language will include the four phases of shell interpretation, namely, command substitution, parameter substitution, blank space interpretation and filename generation, shell parameters and quoting.  Topics covered in the Perl scripting language include an introduction to mathematical operators and functions, comparison operators and the use of conditional and iterative control statements, use of chop and chomp functions with keyboard input, use of the diamond operator (<>) to read a text file, use of arrays and array functions, use of string operators and string functions, accessing files via filehandles, file tests, logical operators, pattern matching, data validation using predefined character class abbreviations.  Assessed work will include the writing of scripts.

On completion of the module a student should be able to

·             create Bourne shell and C shell scripts to access and manipulate data in files

·             create an awk script which uses awk variables and functions to process the contents of a file

·             create Perl scripts to solve mathematical problems

·             create Perl scripts which read from and write to a number of files

·             know the four phases of shell interpretation for the Bourne and C shells

·             select the appropriate scripting language for the solution of the problem

·             select the appropriate program construct for the solution of a problem

How the module will be delivered

This module includes a mix of traditional lectures and laboratory sessions.

12 meetings of 3 hrs.  Each meeting starts with a lecture and finishes with a laboratory session.

1 day school of 4 hours.

40 contact hours.

Skills that will be practised and developed

Intellectual Skills:

·             analyse programming requirements

·             develop computer programming skills

Discipline Specific (including practical) Skills:

·             use basic programming constructs such as conditional statements and loops in each scripting language

·             use of  keyboard input in all Bourne shell, C shell and Perl scripting languages

·             use of arrays in awk and Perl scripts

·             command line argumentprocessing in each scripting language

Transferable Skills:

·             analyse a programming problem and write a well-structured program in one of the  scripting languages

How the module will be assessed

Type of assessment

%Contribution

Title

Duration
(if applicable)

Approx. date of Assessment

Class Test

60

 

2 hours

Final meeting

Coursework

40

 

 

 

Assessment Breakdown

Type % Title Duration(hrs)
Written Assessment 100 Shell And Perl Programming I N/A

Syllabus content

Introduction to some essential UNIX commands

Use of the ex, vi and pico editors

Use of the sort command to sort data in a file

Controlling access of files and directories using the chmod command

How the umask controls access on newly created files

Introduction to the Shell (UNIX Command Interpreter)

Discussion of the four phases of shell interpretation, namely command substitution, parameter substitution, blank space interpretation and filename generation

Shell programs (scripts) and shell parameters

Use of the if, for, while and case program constructs in the Bourne shell

Use of the if, foreach, while and switch program constructs in the C shell

Use of logical operators in both the Bourne and C shells

Keyboard input in both the Bourne and C shells

Use of the awk command to process a file of data

Using awk functions within awk scripts

Introduction to Perl scripts

Use of mathematical operators and functions in Perl

Comparison operators and the use of the if, while, do while, until, do until and for statements

Use of chop and chomp functions

Writing Perl scripts which use keyboard input

Use of the diamond (<>) operator to process the contents of a file

Use of arrays in Perl and initialisation of an array from keyboard input

Use of the split and join array functions

Using string operators and string functions in Perl

Using filehandles to access files and the die and eof functions

Regular expressions and regular expression operators

Validation of data

Essential Reading and Resource List

None

Background Reading and Resource List

Schwartz, R.L., Phoenix T. (2001) Learning Perl  O’Reilly and Associates


Copyright Cardiff University. Registered charity no. 1136855