Synopsis:
Shell Scripting is a very powerful feature of the Linux Operating System. Mostly used for doing repetitive tasks & for testing on Linux platform and automation.
Suitable for:
This course is suitable for system administrators, & automation & testing engineers.
Prerequisites:
Working knowledge of Linux OS.
Basics knowledge of shell commands.
Bourne Again Shell (BASH) Scripting - 40 hrs
Introduction to BASH
Identify BASH installation & key configuration files on RedHat & Debian GNU/Linux distros
.profile/.bash_profile/.bashrc/.bash_history
Identify & use common built-in BASH commands (pwd,cd,set,unset,export,source,etc.)
BASH Command-line Expansion
Brace Expansion
Tilde Expansion
Parameter & variable Expansion
Command Substitution
BASH Reserved words
BASH History identification &configuration
Aliases (ls,du,df,rm,cp)
Backticks - command expansion &execution
BASH Prompt configuration
Command chaining
Error level/Return code (Command Exit Status) identification
Test return 0
Test return 126 - permissions
Test return 127 - command not found
Conditional execution of subsequent commands (&&,||)
Redirection
Standard Input
Direct input from Standard Input
Redirect input from a file
Standard Output
Direct output to Standard Output
Redirect output to a file
Append Standard Output to an existing file
Standard Error
Redirect Standard Error
Input/Output (I/O) Redirection
Pipes
Sequential execution via pipes
Quoting & Escaping
single quotes preserves whitespace, double quotes don't
Full-quoting - single quotes - all enclosed values are literal
Partial quoting - double quotes - all enclosed values are literal except "$, \, `"
\ is the escape character used to treat following strings literally
BASH Scripting
Basic Script definition (hello world), permissions modification & execution
Internal BASH variables
Global Variable definition
Function definition
Local Variable definition - function scope
BASH Arrays
Loops
For
While
Until
Menu creation using Select
Job control - Foreground/Background processing
Conditionals - If-Then-Else - Testing
Case - Concise Conditional Branching
Positional Parameters
Advanced Shell Scripting with Awk & Sed.
Awk & Sed are critical to efficiently parsing textual data (log file contents, data feeds, file & directory listings, etc.). Awk provides field (Column) processing and reporting, whereas Sed facilitates streams (Automated Text Editing) processing. Both support interactive and non-interactive (scripted) execution.
Introduction - Features
Discuss course outline
Discuss features common and distinct to: Awk and Sed
Regular Expressions Review
Enumerate important metacharacters
Provide examples of quatinfier usage
Apply simple character classes to searches
Perform searches in the Bluefish editor using literals and metacharacters
Explain and apply anchors: '^', '$'
Intro to Sed - Stream Editor
Discuss features and applications
Explain general usage syntax
Print specific lines from input
Delete specific lines from input
Match streams using RegExes
Search for ranges of text using line numbers and text ranges
Save transformed output
Sed - Search & Replace
Discuss features and applications
Discuss Left-hand and Righ-hand side (LHS | RHS) sections in search & replace actions
Acquire input from: STDIN, PIPES and Files and transform according to criteria
Backup and overwrite source files using Sed one-liners
Perform substitutions based on matched addresses
Reuse matched strings in replacement output
Perform text substitutions across multiple files
Perform multiple replacements in one command
Apply substitutions globally across all matches
Sed - Scripts
Discuss features and applications
Explain general usage syntax
Create script to remove blank lines from input stream
Create script to make general substitutions
Perform case-insensitive replacements via Sed script
Insert strings into desried location in the input stream via Sed script
Strip trailing numeric values from input stream via Sed script
Apply changes to multiple files
Save scripts for reuse
Intro to Awk - Field Processor& Reporter
Discuss features and benefits
Explain general usage syntax
Print full lines from input
Print desired fields from input
Match patterns using RegExes
Control the input field | column delimiters
Save output
Awk - Scripts
Discuss features and benefits
Explain structure of Awk scripts
Implement BEGIN and END blocks
Parse system files using Awk script
Awk - Variables
Discuss features and applications
Enumerate and discuss key Awk system variables
Increment counters based on matched patterns using Awk
Explain variable concatenation
Explore arrays(lists of values)
Create arrays using the split function
Awk - Operators
Discuss features and applications
Explore Boolean and Relational operators
Discuss looping strategies
Evaluate conditional testing using system variables
Evaluate results
Awk - Process Records
Discuss features and benefits
Define and evaluate multiple input field separators with files with mixed delimiters
Normalize output by controlling the Output Field Separator (OFS)
Extract records from system file and evaluated
Account for number of processed and matched records in END block
Awk - Print Formatting
Discuss features and applications
Compare and contrast 'print' and 'printf' output formatting
Discuss 'printf' supported data types
Evaluate 'printf' application in reporting
Awk & Sed - Various Examples
Discuss features and applications
Parse and cleanup HTML and PHP files with Sed & Awk
Replace values in system file with Awk
Evaluate results
Fill the form below for further enquiry: