This
course provides the necessary skills to write
effective shell scripts to automate the administrative
functions in a UNIX environment
Upon completion of this course, students
should be able to:
· Identify features of Bourne and bash
shells
· Write real world administration scripts
· Write reporting scripts
· Maintain existing scripts
· Use flow control constructs, such as
branching and looping
· Customize system-wide shell initialization
files
· Develop and debug scripts
· Use local and environmental variables
and shell metacharacters in scripts
· Develop interactive scripts
· Write a script that uses functions
· Write scripts that uses functions &
traps
· Access and process command-line arguments
passed into a script
· Write sed scripts to perform noninteractive
editing tasks
· Write nawk scripts to manipulate individual
fields within a record
· Write nawk scripts to write reports based
upon an input file
· Perform string manipulation and integer
arithmetic on shell variables
· Develop a USAGE message to display when
a script in invoked incorrectly
· Identify considerations for using functions
· Identify the features of signals
· Perform the action to trap signals
· Learn to download custom made scripts
and use them
Included Labs
Labs will be provided by the trainer
Minimum Prerequisites
The participants should be able to use basic
UNIX commands and be familiar with vi editor
What will you learn?
Lesson1 - UNIX Shells and Shell Scripts
· Describe the role of shells in the UNIX
environment
· Describe the standard shells
· Define the components of a shell script
· Write a simple shell script
· Set access permissions on a file
· Sequence the steps for scheduling processes
using crontab
· Schedule a process by using the at command
· Writing and Debugging Scripts
· Start a script with #!
· Put comments in a script
· Change permissions on a script and execute
the script
· Debug a script
Lesson 2 - The Shell Environment
· Bourne and Korn shell variables
· Set and unset shell and environment variables
· Customize the user environment using
the .profile file
· Perform arithmetic operations
· Create and use aliases
· Define the built-in aliases
· Customize the Bourne and Korn shell environments
· Use the tilde expansion and command substitution
features of the Korn shell
· Use and describe regular expressions
· Usage of the grep command
Lesson 3 - The sed Editor and nawk command
· Use the sed editor to perform noninteractive
editing tasks
· Use regular expression characters with
the sed command
· Use nawk commands from the command line
· Write simple nawk programs to generate
data reports from text files
· Write simple nawk programs to generate
numeric and text reports from text files
· 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
Lesson 4 - 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
· Perform the action to parse a command
line input by using the getopts command
· 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
Lesson 5 - 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
· Use Korn shell arrays
· Set default values for parameters
· Use the Korn shell built-in let, print,
set, and typeset statements
Lesson 6 - 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
Lesson 7 - Traps
· Describe how the trap statement works
· Include trap statements in a script
· Use the trap statement to catch signals
and handle errors
· Introduction to Korn Shell scripting
· Introduction to C Shell scripting
· Introduction to scripting using Perl
· Downloading sample scripts
· Project
|