Course
Linux Shell Scripting
A 3 day course describing how to develop Linux shell scripts using the programming features of the Bash or Korn shells. This course covers the shell command line, command line parsing, meta characters, I/O redirection, pipelines, quotes, variable substitution, conditional flow control, looping, process substitution. The focus is on using best practices and techniques to develop professional quality scripts. Optionally this course can be customized by combining it with the companion course Linux Command Line Essentials.
Duration: 3 days
Who is it for: People who need to be able to write and maintain linux shell scripts.
Layout: This course comprises a mix of theory, demonstrations and hands on exercises. Approximately 50% of the time is hands-on.
Objectives
- Understanding the command line parsing rules
- Working effectively with variables, wildcards and quotes
- Building command lines using I/O redirection and pipelines
- Making decisions with the if and test commands
- Looping with the for and while commands
- Choosing alternatives with the case and select commands
- Defining and calling functions
- Using advanced variable and command substitution
Modules
Introduction to shell scripts
- Creating and executing scripts
- The source command
- Using the #! (shebang) construct
- Debugging and tracing scripts
- Common features of Korn Shell and Bash
Environment variables
- Review of variables and quotes
- Local and environment variables
- Review of I/O streams and pipelines
- The print and read commands
- Working with shell history
Conditional flow
- The exit command and process status
- The if command
- The test command and [[
- Using the semi-colon command separator
- Numeric variables
Looping
- The while and until command
- The for command
- Compound I/O redirection
Running commands
- Builtin commands
- Useful external commands
- Filter commands and utilities
- Aliases and profiles
The command line
- Command line arguments
- The shift command and $*, $@
- The getopts command
- Array variables
Functions
- Defining functions
- Function parameters and return values
- Sub shells
Handling text
- Command substitution (backquotes)
- Pattern matching variable substitution
- Here documents
Menus
- The select command
- Using the prompt variables
- The case command
Enquire about this course
"*" indicates required fields