Linux / UNIX Bash Scripting - Shell Scripting
Course Description
This course is to help users of Linux / Unix systems to automate the repetitive tasks they encounter during their daily work using "Shell Scripts" or "Bash Scripts". It is a hands-on course with lots of examples and the goal is to encourage and empower participants to "work smarter not harder". One of the best techniques to employ in this effort is to write a script to carry out repetitive tasks.
2 Days
Contact us for pricing
Prerequisites
Participants should have attended the Linux / Unix User Essentials course or have equivalent skills. The course is aimed at Linux / Unix users, programmers and system administrators.Linux / UNIX Processes
What is a Process?Process Structure
The ps Utility
Options to the ps Utility
Background Commands (&)
Killing Background Processes
Redirecting the Standard Error
Combining Linux commands
Redirecting input, output and error streamsPipe operator
Command substitutions (``)
And operator
Or operator
Creating a script
Getting Started
What is a Shell?Running Scripts
Specifying the Script’s Interpreter
The PATH Environment Variable
Sub-shells
chmod +x
Adding a "shebang" to your script
Returning a value from your script
Variables
Shell VariablesThe read Command
The export Command
The Shell Environment
Variable Substitution
Command Substitution
Creating an array
Conditional Statements
The Exit Status of CommandsCommand Line Examples
The test Command
The if-then-else Construct
The elif Construct
case Statements
Loops
The for LoopThe while Loop
Reading Lines From Files
Using Arrays with Loops
Functions
Shell FunctionsPassing Arguments to Functions
Returning Values from Functions
Function Libraries
Special Variables
$$ - PID of ShellCommand-Line Arguments
$# - Number of Arguments
$* - All Arguments
The shift Command
The set Command
Getting Options
Quoting Mechanisms
Single vs. Double QuotesWhat is a Here Document?
Using a Here Document
Here Document Quoting
Ignoring Leading Tabs
.bashrc
The Login ProcessScripts that are run at startup
Making changes persist a reboot
Advanced Programming
Shell ArithmeticThe select Statement
Terminal Independence in Scripts
The eval Command
Debugging techniques
Using echoUsing Standard Error
Options for Debugging
Script Tracing
Conditional Debugging
Shell Scripting Alternatives
If you are working on very difficult automation tasks, utilising a different language such as Perl or Python could be beneficial. This lesson will demonstrate how some of the techniques encountered so far can be applied to scripts that are written in a different programming language.UnixShell programmingshell scriptingLinuxLinux scriptingBashBash ScriptingUnix programmingUnix shellunix scriptingunix shell scripting