Linux Bash Shell Programming

Course Code: LBSP

Duration: 5 days

 
 
 
 

Linux Bash Shell Programming Course Overview

The Linux Bash Shell Programming course is designed to give delegates practical experience in developing and writing Bash shell scripts. Most of the built-in shell commands are introduced together with the main program control structures. The course also gives practical experience using a range of Linux tools to manipulate text and incorporate into Linux Bash shell scripts.

Exercises and examples are used throughout the course to give practical hands-on experience with the techniques covered.

Course Objectives

To provide the skills needed to develop and customise shell programs and to make effective use of a wide range of standard Linux programming and development tools.

Who will the Course Benefit?

Programmers, developers and system administrators who need to construct shell scripts and process text files using advanced text handling facilities.

The Linux Bash Shell Programming course assumes knowledge of the Linux Operating System to the level covered in the Linux Introduction Course. Some programming experience may also prove advantageous.

Note:

This 5-day Linux Bash Shell Programming course is a combination of the Linux Shell Programming and Linux Advanced Shell Programming Tools courses. If the dates allocated to this 5-day course are not suitable, then this course can also be booked by selecting dates from both the Linux Shell Programming and the Linux Advanced Shell Programming Tools courses. The Shell Programming course should be attended first and may start on either a Monday or a Thursday.

Course Information

This 5 Day course combines the LINUX Shell Programming and LINUX Advanced Shell Programming Tools courses. If the dates allocated to this 5 Day course are not suitable then this course can also be booked by selecting dates from both the LINUX Shell Programming and the LINUX Advanced Shell Programming Tools courses. The Shell Programming course should be attended first and may start on either a Monday or a Thursday.

Skills Gained

The delegate will learn and acquire skills as follows:

  • Script naming conventions, locations and best practises
  • Writing simple scripts to enhance basic command output
  • Using the various shell quoting mechanisms
  • Manipulating shell variables and user-defined variables
  • Performing arithmetic within scripts
  • Script interaction and arguments
  • Implementing conditional execution facilities
  • Iteration with constructs
  • Performing multi-branch decisions
  • Implementing AWK within scripts
  • Trapping user interrupts
  • User defined Functions
  • Creating menu-driven scripts
  • Backing up and restoring files with tar
  • Advanced tar commands
  • File compression
  • Formatting and viewing file content
  • Scheduling background jobs with crontab and at
  • Comparing file contents
  • Splitting files based on content and context
  • Identifying and translating characters
  • Use og grep and regular expressions
  • Basic and advanced file editing with sed
  • Writing output to temporary files
  • Creating AWK program-files and scripts
  • Pattern matching with AWK
  • AWK variables, operators and arithmetic functions
  • AWK program control structures
  • AWK functions
  • AWK associative and multi-dimensional arrays
  • Various miscellaneous commands

Linux Bash Shell Programming Training Course

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
  • Exercises: 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: CONDITIONAL EXECUTION

  • The if statement
  • The test command
  • Exercise: Adding validation to previous scripts

Session 7: ADDITIONAL KORN, BASH & POSIX SYNTAX

  • Other test notations
  • Default and substitute variables
  • Exit status codes
  • Exercise

Linux Bash Shell Programming Training Course

Session 8: 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 9: MULTI-BRANCH DECISIONS

  • The case statement
  • Menu driven applications
  • Exercise: Developing and writing a menu system

Session 10: SCRIPTING WITH AWK

  • Fundamentals of AWK
  • Basic AWK scripts
  • AWK within Bash constructs
  • Exercise: AWK scripts

Session 11: FUNCTIONS

  • What is a function?
  • Syntax
  • Examples
  • Creating a Function Library
  • Exercise: Add a function to a script

Session 12: INTERRUPT HANDLING

  • Interrupt signals
  • Trapping interrupts
  • Exercise: Adding traps to the menu script

Appendix A: ADDITIONAL FEATURES AND FACILITIES

  • The exec commands
  • The includes notation
  • More about loops
  • Arrays

Appendix B: VIM QUICK REFERENCE

Appendix C: UNIX COMMANDS QUICK REFERENCE

Appendix D: ADDITIONAL EXERCISES

Linux Bash Shell Programming Training Course

Session 13: BACKUP AND RESTORE UTILITIES

  • Backing-up and restoring files
  • Basic and advanced use of tar
  • Compression utilities gzip, bzip2, zip and compress
  • Exercise: Backing up and restoring files using tar
  • Exercises: Compressing files

Session 14: BACKGROUND JOB SCHEDULING

  • Scheduling jobs with the cron command
  • Scheduling jobs with the at command
  • Exercises: Running background jobs

Session 15: COMMANDS FOR COMPARING FILES

  • Compare files with the cmp command
  • Compare and format files with pr
  • Compare files with the comm command
  • Compare files with the diff and sdiff commands
  • Compare large files with the bdiff command
  • Exercises: Identifying file differences

Session 16: SPLITTING FILES

  • The fold command
  • Split files using context and content rules
  • Exercises: Splitting files

Linux Bash Shell Programming Training Course

Session 17: IDENTIFYING AND TRANSLATING CHARACTERS

  • od - octal dump
  • Use cat to display non-printing characters
  • View and format files with nl
  • The expand and unexpand commands to convert between tab and space characters
  • The tr command for character translation
  • Exercises: Translating characters with tr

Session 18: REGULAR EXPRESSION NOTATION REVIEW

  • Standard regular expressions
  • Searching with grep
  • Metacharacters, positional characters and quantifiers
  • Extended regular expressions
  • POSIX character classes
  • PERL expressions

Session 19: THE STREAM EDITOR sed

  • sed command line syntax
  • sed script files
  • sed command processing
  • sed addresses and simple instructions
  • sed pattern space and hold space
  • Grouping sed commands
  • Hold and get functions
  • Advanced flow control
  • Write output to temporary files
  • Exercises: Text processing with sed

Session 20: FUNDAMENTALS OF AWK

  • Basic AWK usage
  • AWK program-files
  • AWK scripts
  • AWK variables
  • Pattern matching with AWK
  • AWK extended patterns

Session 21: AWK OPERATORS

  • AWK operators
  • AWK arithmetic operations
  • AWK output
  • Formatting output with printf
  • Exercises: Create awk scripts to extract selected data from a file and generate reports

Linux Bash Shell Programming Training Course

Session 22: AWK PROGRAM CONTROL STRUCTURES

  • The BEGIN and END functions
  • The AWK if construct
  • The AWK else if construct
  • The AWK while construct
  • Other program control statements
  • The AWK break, continue and exit statements
  • User defined functions
  • Exercises: Create AWK scripts and program-files utilising program control structures

Session 23: AWK FUNCTIONS

  • AWK string functions
  • AWK length, tolower, toupper, index, sub, gsub, match, substr, split, sprintf, system and getline functions
  • Exercises: Generate AWK scripts and program-files to extract and format data using AWK functions

Session 24: AWK ARRAYS

  • AWK associative arrays
  • Multi-dimensional arrays
  • Exercises: Create AWK associative arrays to process text files and generate reports

Session 25: MISCELLANEOUS TOOLS

  • bc (calculator)
  • fuser (testing for files in use)
  • getops (checking options passed to shell scripts)
  • printf (formatting screen output)
  • logger (script logging)
  • xargs (generating arguments for a command)
  • eval (re-evaluating variables)
  • Exercises: Using tools within a shell script
Notes:
  • Course technical content is subject to change without notice.
  • Course content is structured as sessions, this does not strictly map to course timings. Concepts, content and practicals often span sessions.

Requirements

The Linux Bash Shell Programming course assumes knowledge of the Linux Operating System to the level covered in the Linux Introduction course. Some programming experience may also prove advantageous.

Pre-Requisite Courses

Course Reviews

I've been on a number of other courses but I found Mark to be an exceptional instructor, spot on with his delivery I can't praise him enough. If only all institutors could be like him!

Colin - Network Engineer - IT

John was a fantastic trainer - really engaging and kept the course moving at a brilliant pace - I was not so familiar with Linux and he really kept me included. I have really enjoyed the course and think for this particular subject to keep it so lively and engaging is a credit to John. Thanks very much !

Arun - Government

Great instructor and very passionate about the subject matter. The course was very useful and I will be taking a lot of the lessons learned back to the workplace.

Mike - WMS Application Specialist - Postal/Distribution

Excellent Lecturer, very steady pace with excellent explanations. Without this course It would have taken months to be at the same level after 5 days.

James - Senior Field Engineer - IT

Lecturer full of confidence and conveyed course material to an exceptional level. He made the course extremely enjoyable.

Jake - Software Engineer - Manufacturing

The trainer was excellent - paced the course exactly right, very clear presentation style and showed a great depth of knowledge around the topic also.

Fraser - Technical Prime - Communications

Public Scheduled Events

Classroom & Live Virtual Instructor-Led Training

Duration: 5 days

Price: £2,450.00 exc. VAT 


Start Date Options Spaces  
20 Jan 2025
StayAhead Virtual Courses available 
Spaces Book Now 
17 Mar 2025
StayAhead Virtual Courses available 
Spaces Book Now 
12 May 2025
StayAhead Virtual Courses available 
Spaces Book Now 
07 Jul 2025
StayAhead Virtual Courses available 
Spaces Book Now 
08 Sep 2025
StayAhead Virtual Courses available 
Spaces Book Now 
03 Nov 2025
StayAhead Virtual Courses available 
Spaces Book Now 
 

Live Virtual Classroom

 
Join live instructor-led classroom training from the comfort of your home or office.
All the convenience and benefits of the classroom experience without the hassle and costs of travel and accommodation.
 
 



Our Customers Include

 
EDF
Amazon
American Express
Aviva
QA
BAE
University of Cambridge
Barnardo's
Scottish Government
Bauer
Bloomberg
BP
HSBC
DVLA
GlaxoSmithKline
Government Campus
Capita
Tui
NHS
Ordnance Survey
Ministry of Defence
Zurich Insurance Group
trainline
Vodafone
 
 



Our Course Curriculum

 
 
 
+44 (0)20 7600 6116
Enquiries@StayAhead.com
Copyright © 2024 StayAhead Training Ltd
Cookies   /   Privacy Policy