GL375 - Linux Shell Scripting

The GL375 is designed to provide the skills necessary to automate tasks on a Unix or Linux system. Systems Administrators and Developers alike can avoid errors, save time and money by replacing repetitive work patterns with shell scripts.

Care has been taken to present the GL375 in a format that benefits all students, with or without previous programming experience. Guru Labs believes that the best way to learn shell scripting is writing shell scripts. For this reason, lab time is emphasized. Early labs present the scripting process step by step, while later labs are presented in a challenge format. While official solutions to each lab task are provided, students are encouraged to create their own before examining the solution. In this way, more experienced students are challenged without overwhelming the less experienced.

Prerequisites:

Solid understanding of Unix-based systems and proficiency on the Unix or Linux command line.

Supported Distributions:

Red Hat Enterprise Linux 5 Update 4

Recommended Class Length:

2 days

Detailed Course Outline:

  1. SHELL SCRIPTING BASICS
    1. Shell Scripting
    2. Example Shell Script
    3. Shell/Environment Variables
    4. Key Environment Variables
    5. General Quoting Rules
    6. Nesting Commands
    7. Variables: Arrays
    8. Positional Parameters
    9. printf
    10. Input and Output
    11. alias
    12. Functions
    13. Colors in Scripts
    Lab Tasks
    1. Shell Variables
    2. Shell Meta-Characters
    3. Command Substitution
    4. Aliases
    5. Bash Login Scripts
    6. Create "userinfo" and "sysinfo" functions
  2. WORKING WITH FILES
    1. Communication Channels
    2. File Redirection
    3. Piping Commands Together
    4. Doing Math
    5. Determining Disk Usage
    6. cron
    7. crontab Format
    8. /etc/cron.*/ Directories
    9. Sending Email with mail
    Lab Tasks
    1. Disk and Filesystem Usage
    2. Connecting Commands
  3. DATA MUNGING
    1. Regular Expression Overview
    2. Regular Expressions
    3. RE Character Classes
    4. RE Quantifiers
    5. RE Parenthesis
    6. Searching Inside Files
    7. Replacing Text Characters
    8. The Streaming Editor
    9. Text Processing with awk
    10. Text Sorting
    11. Duplicate Removal Utility
    12. Extracting Columns of Text
    Lab Tasks
    1. Pattern Matching with Regular Expressions
    2. Extended Regular Expressions
    3. Using Regular Expressions With sed
    4. Create "rmhost" function
    5. Create "showenv" function
    6. Parsing Mail Server Logs
    7. Fixing Incorrect Files
  4. BRANCHING AND LOOPING
    1. Exit Status
    2. Comparisons with test
    3. Conditional Statements
    4. Flow Control: case
    5. The for Loop
    6. Flow Control: while and until Loops
    7. Reading Files with while
    8. Flow Control: select
    Lab Tasks
    1. Reporting User Statistics
    2. Monitoring Filesystem Usage
  5. SECURITY, WHITESPACE AND OTHER GOTCHAS
    1. Gotchas: Maximum Command Length
    2. Gotcha: Whitespace in for Loops
    3. Gotcha: $IFS
    4. Gotcha: Printing in .bashrc
    5. Gotcha: Aliases
    Lab Tasks
    1. Renaming MP3 Files
    2. Split and Display $PATH
    3. A tar-based Backup
  6. WHERE TO FROM HERE?
    1. Waterfall Development
    2. Iterative Development
    3. Getting Help with man and info
    4. $MANPATH, whatis and apropos
    5. Help from Commands and Documentation
    Lab Tasks
    1. Automated Virtual Host Provisioning
 
Copyright (C) 2010, Enigma Logic Inc.