Shell Scripting

Abstract

A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.

Many shell script interpreters double as command line interface, such as the various Unix shells, Windows PowerShell or the MS-DOS COMMAND.COM. Others, such as AppleScript or the graphical Windows Script Host (WScript.exe), add scripting capability to computing environments without requiring a command line interface.

In their most basic form, a shell script can provide a convenient variation of a system command where special environment settings, command options, or post processing is applied automatically, but in a way that allows the new script to still act as a fully normal UNIX command.

Objective

This short course is designed to ensure that students of Engineering College with academic

Capabilities will have the skill set needed to deal with the challenges involved in real-world Scripting to meet the needs of industries both today and in the future. 

The course is taught mainly using the Bash Shell, with Linux operating system.Pre-requisites

A prior knowledge of a basic Linux commands, general understanding about operating system concepts is assumed.

Agenda
  • The duration of the course will be 32 hours.
  • The course is split into eight modules.
  • Total Duration - Theory 16 Hrs - Lab 16 Hrs .
Modules:
  • Introduction to shells and scripts:
    • Shells, Usage, Types, entering and editing commands, Shell scripts, tools for editing, writing scripts.
  • Running and Controlling Scripts:
    • Referencing variables, loops and iterations, conditionals, if, test, case, examining environment variables, customizing accounts, handling CLI, executing.
  • Shell Scripting Functions:
    • Defining and Using Functions, arguments, return codes, variable scope, and global, local recursion.
  • Debugging Shell Scripts:
    • Deciphering Error Messages, Debugging Techniques and Running Scripts in Debugging Mode.
  • Scripting with Files and Text Processing with sed:
    • Combining Files into Archives, File Modes, test, here files and Interactive Programs.
  • Processing Text with sed:
    • Introduction, Versions, working with sed, selecting lines, substitution, advanced sed invocation, Advanced Addressing, Advanced Substitution, Hold Space.
  • Processing Text with awk:
    • Awk (Gawk, Mawk, Nawk, Oawk), Working with awk, invoking awk, control statements, functions.
  • Controlling Processes:
    • Exploring Processes, Launching processes Capturing output.