Duration: 5 Days
In this course, you will cover advanced POSIX shell programming for technical users and system administrators. You will learn the tools necessary to automate complex tasks and increase productivity. You will spend 50 percent of class in hands-on labs.
What You Will Learn
- POSIX shell programming and using it to save time with automated scripts
- Write efficient programs by understanding how shell scripts are
processed
- Customize shell start-up files
- Easily control your administration tasks
Audience
HP-UX and UNIX general users, system administrators, network administrators, and software developers
Prerequistes
- UNIX Fundamentals or equivalent experience
- Fundamental knowledge of programming
Course Outline
1. POSIX Shell Scripts
- Shell Script
- Script
Execution
- Subprocess
Environment
- Shell Features
2. Shell Scripting
- Which Shell?
- Recommended
Shell Format
- Planning to
Write a Shell Script
- Portability Issues
3. Variables
- Variables
- Displaying and
Using Variables
- Concatenation and Substrings
- Other Sources of Data for Variables
4. User input
- Reading User Input
- Positional Parameters
- Creating Positional Parameters
- Conditional Substitution
- External Influences
5. Designing Program Output
- Variable Attributes
- Formatted Data
- Cursor
Positioning and Terminal Echo
6. Shell Arithmetic
- Creating Integer-Only
Variables
- Base 10 and
Others
- Working with
Arithmetic Operators and Data
7. Branching and Logic
Testing
- Logic Testing
- Conditional Operators
- Multi-Way Branching and the 'Case' Statement
8. Shell
Patterns
- Basic Expressions
- More Complex Patterns
- Pattern Combinations
9. Program Loops
- 'While' Loop
- 'Until' Loop
- 'For' Loop
- Breaking Out of a Loop and Continuing
- 'Select' Loop
10. 'Getopts' Command
- Processing Arguments
- The
getopts and OPTARG Variable
- The OPTIND Variable
11. Array Variables
- Substituting and Counting
- Using Integer Variables as Element Numbers
12. Functions and Function
Libraries
- Displaying
Current Shell Functions
- Declaring and Using Functions
- Variable Scope
- Function
Libraries and Recursion
13. Managing Input and Output
- File Descriptors
- Reading/Writing Using File Descriptors
- Redirecting, Parameter Lists, and 'Here' Documents
- Creating Parameter Lists from Input Lines
14. Traps and Signals
- Common Signals
- Trap and
Stty Commands
15. Regular Expressions
- Regular Expressions
- Metacharacters
- 'Grep'
Command
16. Introduction to 'Awk'
- Record Processing
- Pattern
Matching and Relational Expressions
- 'Awk' Variables
17. Variables, Strings, and Arithmetic Operations
- 'Awk' User Defined Variables
- Environment Variables
- Arithmetic Operations
- String Manipulation
- Formatted Output
- Command
Line Arguments
18. 'Awk' Flow Control
- Conditional 'If', While, and For Loops
- Arrays
- 'getline', 'Next',
and 'Exit'
- Processing
Arrays
- Associative Arrays
19. Stream Editing with 'Sed'
- Substituting Text
- Deleting
and Printing Lines
- Reading
and Writing Files
- Multiple
'Sed' Editor Functions
Course Labs