
UNIX Shell Programming
Overview
This Unix Shell Programming training course is designed to give delegates practical experience in developing and writing UNIX shell scripts Most of the built-in shell commands are introduced together with the main program control structures. This course is not suitable for C shell programmers.
Objectives
To provide the skills needed to develop and customise unix shell programs.
Outline
Course Contents - DAY 1
Course Introduction
- Administration and Course Materials
- Course Structure and Agenda
- Delegate and Trainer Introductions
Session 1: UNIX COMMAND REVIEW
- Basic Unix commands
- General commands
- File and directory handling commands
- Filename generation characters
- I/O Redirection features
- Other commands
Session 2: GETTING STARTED
- What is a shell script?
- Development guidelines
- Creating and editing shell scripts
- Naming and storing shell scripts
- Executing shell scripts
- Exercise: Write a simple shell script
Session 3: USING VARIABLES
- Environment variables
- Local variables
- Assigning values to variables
- Assessing variable values
- Using quotes
- Delimiting variable names
- Echo control sequences
- Exercise: Add variables to a script
Session 4: INTEGER ARITHMETIC
- Using the expr command
- Using the (( )) notation
- Exercise: Add integer arithmetic to a shell script
Session 5: HANDLING RUN TIME DATA
- The read command
- Command line arguments
- Exercise: Writing a generic shell script
- Exercise: Writing an interactive shell script
Session 6: CONDITION EXECUTION
- The if statement
- The test command
- Other test notations
- Default and substitute variables
- Exit status codes
- Exercise: Adding validation to previous scripts
Course Contents - DAY 2
Session 7: LOOP CONSTRUCTS
- The while loop
- The until loop
- The for loop
- The while true and until false loops
- Loop control commands
- Exercise: Enhancing the previously written scripts
- Exercise: Writing a script to copy files using a 'for' loop
- Exercise: Writing a script to generate numbers with the 'while' loop
Session 8: MULTI-BRANCH DECISIONS
- The case statement
- Menu driven applications
- Exercise: Developing and writing a menu system
Session 9: FUNCTIONS
- What is a function?
- Syntax
- Examples
- Exercise: Add a function to a script
Session 10: INTERRUPT HANDLING
- Interrupt signals
- Trapping interrupts
- Exercise: Adding traps to the menu script
Session 11: ADDITIONAL FEATURES AND FACILITIES
- The exec commands
- The includes notation
- More about loops
- Arrays
- Here Documents
- Exercise: Create a here script