Overview
LiveFire Labs' Korn Shell Scripting course, which is compatible with the BASH shell, teaches you the skills required for developing basic and intermediate-level Korn shell scripts.
The course begins with a summary of the concepts and operators that make the Korn shell one of the most powerful scripting environments in UNIX and Linux today, then shows you in a step-by-step manner how shell scripts are written, their common uses, how they interact with other operating system functions, and examples of well-written shell scripts.
Hands-on lab exercises are used to reinforce key concepts, and are completed by logging in on a real server in our Internet Lab from your work or home computer.
- The Korn Shell Environment
- Standard Files and Special Operators
- Using Aliases
- Shell Variables and Functions
- What is a Shell Script?
- Writing a Basic Shell Script
- Advanced Shell Scripting
Just as Windows is the world-recognized operating system interface to the
majority of PC's in use today, the shell is the standard interface to UNIX
and Linux operating systems. When you log on, the shell prompt represents
your first opportunity to issue commands directly to the operating system.
While the shell prompt displayed differs depending on the type of shell
invoked - $ and % prompts are displayed for Bourne and C shells,
respectively - the Korn shell (also a $ prompt) is the most powerful,
widely used shell in today's environments. This course focuses exclusively
on the scripting capabilities available in the Korn shell.
- What is a Korn Shell?
- Starting up a Korn Shell
- Basic shell behavior
While the Korn shell is a powerful, versatile tool that is indispensable
in communicating with the operating system, it was written from a
programmer's perspective - therefore, it is not intended to serve as a
high-level, user-friendly interface. It functions according to explicit
commands and shows little tolerance for the uninitiated. Therefore, it is
important to be familiar with the basic rules that give the shell its
unique character.
- How the Korn Shell sees things
- Pattern matching and standard metacharacters
- Recalling and modifying commands
- Redirects, pipes, and input/output operators
- Redirects, pipes, and input/output operators (appending and pipes)
- Command substitution
- Using grep
- Using grep (metacharacters and pipes)
- Basic filters
In the Korn shell, aliases are synonyms for longer commands. Or, in other
words, they are miniature shell scripts that are stored in the working
memory of the shell instead of a file. Aliases are probably the most
widely used way of customizing your environment to save typing and give
more recognizable names to complex commands.
- Making aliases
- Listing aliases
- Removing aliases
A key to basic shell scripting is the ability of the Korn shell to
combine standard commands with user-defined data to create more efficient,
customized tools. In addition to command substitution and aliases, the
Korn shell supports shell variables and functions that behave in similar,
but more powerful ways.
- Shell variables
- Shell variables (displaying, changing, deleting)
- Shell variables (substitution, protection, combining)
- Functions
- Creating functions
A shell script is merely an executable file containing multiple shell
commands that are executed sequentially. The file can contain:
· a shell definition statement
· comments
· commands
The Korn shell supports a number of features and functions that make
learning shell scripting techniques preferable to learning a standard
programming language such as C or C++. An added bonus of using a shell
script is that it is interpreted, meaning that it does not have to be
compiled like most programming languages.
- An overview
- Shell script execution
- Shell scripts - an illustrated view
In previous modules, we covered a lot - if not most - of the shell
features and commands that might be used in a basic shell script. We also
touched briefly on some rules that well-written shell scripts should
follow. In this module, we'll get more detailed about the proper construct
of a good shell script and also show some other ways that scripts receive
and interpret data. At the very end, we'll put those things to use in
building a shell script that you can execute on the lab system.
- What's in a shell script
- Conditionally executing commands in a shell script
- Passing information to a shell script using positional parameters
- Using the read command
- Interactively passing variables to the read command
- Flow control and looping commands (while and case)
- Flow control and looping commands (exit and break)
- Flow control and looping commands (select)
- Putting it all together (menu script #1)
- Putting it all together (menu script #2)
The final module of the course discusses Korn shell scripting tools used
by more advanced script writers. Again, it would impossible to cover
everything that is available as a resource for script writers using the
Korn shell, but the things discussed in this module show up often in
intermediate-to-complex scripts.
- Looping and logic
- Looping and logic (if, if-else, and elif)
- More flow control and looping statements (for and until)
- More flow control and looping statements (continue and nested loops)
- Scheduling automatic script execution with the cron program
- Using escape characters with the print command
- Error checking and debugging your shell scripts
- Arithmetic operators
- The ((...)) command
Prerequisites
Completion of our UNIX and Linux Operating System Fundamentals course, or an understanding of the concepts covered in that course is required.
Course Duration
You will have access to the online course content and Internet Lab system for 8 weeks (24/7). This initial access period can be extended (with NO additional fee) if you need more time to complete the course.
Course / Lab Support
Your "Getting Started" email will contain the name and email address of your assigned LiveFire Labs training specialist, who will check in with you shortly after you start the course to find out how things are going and to see if you have any questions. You can also email your training specialist, who is an experienced UNIX technologist, whenever you have questions about the course material or hands-on lab exercises.
Getting Started
Follow the registration steps below if you are ready to learn UNIX shell scripting, or contact us with any questions you may have. You can optionally check our FAQ for answers to common questions or view our Testimonials page to read what previous students think about our online courses and Internet Lab.