Cette page n’existe pas encore en français. Voici la version anglaise.

Dernière mise à jour du programme :

Course Overview

This course teaches you to write shell scripts with the Bash shell to automate everyday tasks on Linux. It covers variables and arrays, conditional logic, loops, menus, functions and script debugging, with an optional extension on sed, awk and getopts.

The course is based on Ubuntu, and the scripts and principles apply equally to other Linux distributions such as Red Hat Enterprise Linux, Fedora, Debian and SUSE.

The course takes the format of a workshop, with a mix of lecture, working examples and practical exercises. Full course notes are provided along with sample files.

Course Prerequisites

The course is only suitable for those who have a working knowledge of Linux/Unix or have attended the LINUX-FUNDAMENTALS course.

Outline

Linux Shell Scripting Course Outline

Day 1

Overview

  • Aims and Objectives
  • Schedule and Introductions
  • Pre-requisites
  • Responsibilities

Shell Programming

  • Creating and testing shell scripts
  • Script file creation and permissions (chmod +x)
  • $PATH variable and script location
  • Login files and the . (dot) command
  • Parameter passing and the read command
  • Output formatting
  • Shell selection
  • Script debugging
  • Review exercise

Special Characters and Variables

  • Quotation marks (", ', `)
  • Using $(...)
  • System, special, and user variables
  • Variable management (unset, declare)
  • Script variables and scope
  • Variable constructs and brackets usage
  • Regular expressions
  • Command substitution and subshells

Selection

  • if statements and conditional testing
  • File attributes and the test command
  • [ ] syntax and logical constructs
  • Multiple tests and elif
  • Numeric testing with (( ))
  • String testing
  • case statements
  • Input validation
  • Review exercise

Day 2

Iteration and Looping

  • Computations (let, expr)
  • while and until loops
  • for loops and sequence generation
  • Parameter handling with shift
  • File operations and pipe handling
  • Review exercise

Menu Creation

  • Implementing menus with case statements
  • Loop constructs
  • Output control (sleep, read, exit, break)
  • Shell forking
  • Signal handling with trap
  • Text formatting with tput
  • select menus

Functions and Arrays

  • Function creation and management
  • Return values
  • Array operations
  • String handling
  • Review exercises

Optional Extension: Advanced Topics

Sed Batch Editor

  • Stream editing fundamentals
  • Regular expressions
  • Basic operations (d, p, n)
  • Text substitution and pattern replacement
  • File handling
  • Flow control

Awk Utility

  • Pattern matching and regular expressions
  • Script creation and debugging
  • Built-in functions
  • Parameter handling
  • Arrays and control flow
  • Examples

Advanced Commands

  • eval usage and features
  • Argument handling with getopts
  • Script debugging techniques

Appendix A - Linux Revision

  • Shell customization
  • Command features
  • I/O operations
  • Process management
  • Text processing
  • File permissions

Course Review

  • Course summary
  • Reference materials
  • Basic command review
  • Editor basics (vim, nano)

Frequently asked questions

How long is the Linux Shell Scripting course?

2 days, online. Sessions can run on consecutive days or be spread out to fit your team's schedule.

What are the prerequisites?

The course is only suitable for those who have a working knowledge of Linux/Unix or have attended the LINUX-FUNDAMENTALS course.

How large are the groups?

Deliberately small so the trainer can adapt to every participant: at most 7 online.

Cette formation m’intéresse, mais j’ai une question

Formations associées