Professional Documents
Culture Documents
Shell Scripting Daywise Contents
Shell Scripting Daywise Contents
Objective
Learn effective methods to create and use Shell scripts and utilities. Shell scripts are often the key to
becoming a productive Unix/Linux system administrator. During this course you will learn to write scripts
that demonstrate your ability to write shell scripts in Unix/Linux environment.
Course Outline
Day 1
Introduction
Shells
Types of UNIX Shells
Uses of Shell Scripts
Advantages of Shell Scripts
First Shell Script
Bash Basics
Initialization Files
Aliases and Variables
Working with Variables
Important Internal Bash Variables
Command History
Input and Output Channels
Redirection to Files
The Here Script Operator
Feeding output to Another Process
Duplicating the Output with tee
Types of Commands
Introduction to Variables
Variable Substitution
Variable Assignment
Special Variable Types / Internal Variables
Typing Variable
Declare / typeset
Quoting
Quoting Variable
Escaping
Creating and Using Arrays
Lab Exercises
Day 2
Test
Test Constructs
File test operators
Mathematical Comparators
String Comparators
Checking Variables
Other Comparators`
Nested if/then Condition Tests
Lab Exercises
Loops and Branches
Case Statement
While Loop
For Loop
Loop Control
Breaking out Current Loop
Testing and Branching
Prompting for User Input
read command
Using Arguments
Argument variables
Special argument variables
using arguments
Lab Exercises
Day 3
Strings and substrings
Searching and Replacing Substrings
Obscure but Useful String Operations
Simple regular expression matching
Commands
(Mastering commands in Unix/Linux in an indispensable prelude to writing effective shell scripts)
Internal Commands
echo, printf, read, cd, pwd
let, eval, set, unset, export, typeset, declare, readonly, getopts, exit, exec
External Commands
grep, awk, cat, chmod/chown, clear, cp/mv, cut, date, env
ln, kill/killall, ls, umask
sort, uniq, wc
Functions
Simple Function
Complex Function