Advanced Shell Scripts

This 2 day instructor led class, is designed for system administrators.  Students will learn advanced power tools as well as how to customize the POSIX Korn shell.

Detailed Course Outline

• Writing and Running Shell Scripts

• Command Substitution

• Shell Variables and Variable Substitution

• Shell Environment Variables

• Comments

• Getting User Input – Read

• The for Loop and if Statement

• Exit Status or Return Code

• The test Command

• The case Statement

• Simple Conditionals

• The set Command

• Arithmetic with shell variables

Remote Connections

• Connect remotely using telnet and ssh

• Transfer files with ftp and sftp

Advanced File Management

• Creating links

• Processing files with “awk”, “tr”, and “sed”

• Use awk/nawk commands from the command line

• Write awk programs to generate data reports from text files

• Write awk programs to generate numeric and text reports from text files

Regular Expressions and the grep Command

• Use and describe regular expressions

• Describe the grep command

• Use the grep command to find patterns in a file

• Use the regular expression characters with the grep command

• Metacharacters

• The grep command

Command line database processing

• Using awk to display file contents and process data

• Formatting files with the tr command

• Using UNIX filters to filter, sort and restructure data

• Use awk to scan text files or standard input to display specific data, change data format, and add text to existing data

Stream Editing with ‘sed’

• Use sed to perform noninteractive editing tasks

• Substituting text

• Deleting and printing lines

• Reading and writing files

• Multiple ‘sed’ editor functions

• Use regular expression characters with the sed command

Writing and Debugging Scripts

• Creating a shell script

• Put comments in a script

• Change permissions on a script

• Execute a script

• Debug a script

String Manipulation

• String Comparison

• String Relations

• Concatenation

• Substring Manipulations

• Wildcards and Pattern Matching

Conditionals 

• Use the exit status of a command as conditional control

• Use the “if” statement to test a condition

• Pass values using command-line arguments (positional parameters) into a script

• Create USAGE messages

• Place parameters on the command line

• Use conditional if, then, elif, else, and fi constructs

• Use exit, let, and test statements ([[ ]], ” “)

• Apply the &&, ||, and ! Boolean logic operators

• Use the case statement

Interactive Scripts

• Use the print and echo commands to display text

• Use the read command to interactively assign data to a shell variable

• Read user input into one or more variables, using one read statement

• Use special characters, with print and echo, to make the displayed text more user friendly

• Create a “here” document

• Use file descriptors to read from and write to multiple files

Loops

• Write scripts that use for, while, and until loops

• Write a script using the select statement

• Describe when to use loops within a script

• Generate argument lists using command, variable, and file-name substitution

Advanced Variables, Parameters, and Argument Lists

• Declare strings, integers, and array variables

• Manipulate string variables

• Change the values of the positional parameters using the set statement within a script

• Pass values using command-line arguments (positional parameters) into a script

• Declare korn shell string and array variables

• Setting and retrieving arrays

• Set default values for parameters

• Use the Korn shell built-in let, print, set, and typeset statements

• Reading user input

• Positional parameters

• Creating positional parameters

• Conditional substitution

• Working with arithmetic operators and data

Functions

Create user-defined functions in a shell script

• Create, invoke, and display functions from the command line

• Pass arguments into a function

• Call functions from special (function) files that are saved in one or more function directories

• Describe where functions are available for use

Controlling Script Behavior

• Manage the use of temporary files

• Write scripts using the setuid bit

• Use the crontab command

Scheduling Execution

• sleep

• date

• cron and crontab

Traps

• Describe how the trap statement works

• Include trap statements in a script

• Use the trap statement to catch signals and handle errors

To Hire the Course Author, an AIX Subject Matter Expert and Instructor who also teaches this class, call us today at 800-798-3901!

Leave a Reply