Bash Programming (LNX411)
Course Length: 3 days
Delivery Methods:
Available as private class only
Course Overview
This 3-day Bash Programming training class provides a thorough introduction to bash programming by covering topics like shell variables and functions, the login process, using arrays with loops, and debugging techniques such that by the end of the course, students will be able to take full advantage of the bash shell. This course is intended for Linux or UNIX users, programmers, and system administrators.
Course Benefits
- Understand the foundational concepts of UNIX processes, including process management and the use of system utilities like the ps command.
- Develop a solid understanding of the UNIX shell environment, including how to run scripts and manage shell variables.
- Learn how to effectively manage user login processes and environment scripts to optimize the UNIX user experience.
- Master conditional statements and loops to automate tasks and manipulate data efficiently within the UNIX system.
- Gain detailed knowledge on special shell variables and how to utilize them in scripting for advanced task management.
- Enhance your scripting abilities by understanding quoting mechanisms and their applications in securing text processing tasks.
- Acquire skills in defining and using shell functions, passing arguments, and returning values to streamline complex tasks.
- Explore advanced programming concepts like shell arithmetic and terminal independence to create robust scripts.
- Learn debugging techniques that include script tracing and conditional debugging to enhance the reliability of scripts.
- Benefit from practical, hands-on exercises that reinforce learning and application of shell scripting in real-world scenarios.
Course Outline
- Course Introduction
- Course Objectives
- Course Overview
- Using the Workbook
- Suggested References and Reading
- UNIX Processes
- What is a Process?
- Process Structure
- The ps Utility
- Options to the ps Utility
- Background Commands (&)
- Killing Background Processes
- Redirecting the Standard Error
- Getting Started
- What is a Shell?
- Running Scripts
- Specifying the Script's Interpreter
- The PATH Environment Variable
- Sub-shells
- Variables
- Shell Variables
- The read Command
- The export Command
- The Shell Environment
- Parameter Expansion
- Command Substitution
- The Login Process
- The Login Process
- The System Profile Script
- Your .bash_profile Script
- The . Command
- Conditional Statements
- The Exit Status of Commands
- Command Line Examples
- The test Command
- The if-then-else Construct
- The elif Construct
- case Statements
- Loops
- The for Loop
- The while Loop
- break and continue
- Reading Lines From Files
- Using Arrays with Loops
- Special Variables
- $$ - PID of Shell
- Command-Line Arguments
- $# - Number of Arguments
- $* - All Arguments
- The shift Command
- The set Command
- Getting Options
- Quoting Mechanisms
- Single vs. Double Quotes
- What is a Here Document?
- Using a Here Document
- Here Document Quoting
- Ignoring Leading Tabs
- Functions
- Shell Functions
- Passing Arguments to Functions
- Returning Values from Functions
- Function Declarations
- Advanced Programming
- Shell Arithmetic
- The select Statement
- Terminal Independence in Scripts
- The eval Command
- Debugging Techniques
- Using echo
- Using Standard Error
- Script Tracing
- Options for Debugging
- Conditional Debugging
Class Materials
Each student will receive a comprehensive set of materials, including course notes and all the class examples.
Class Prerequisites
Experience in the following is required for this Linux class:
- Knowledge of fundamentals of UNIX or Linux.
Live Private Class
- Private Class for your Team
- Live training
- Online or On-location
- Customizable
- Expert Instructors