Innovation... driven by intelligence and logic

Shell Scripting using Bash

Abstract:

The shell is a command interpreter. More than just the insulating layer between the operating system kernel and the user, it's also a fairly powerful programming language. A shell program, called a script, is an easy -to- use tool for building applications by "gluing together" system calls, tools, utilities, and compiled binaries. Virtually the entire repertoire of UNIX commands, utilities, and tools is available for invocation by a shell script. If that were not enough, internal shell commands, such as testing and loop constructs, lend additional power and flexibility to scripts. Shell scrip ts are especially well suited for administrative system tasks and other routine repetit ive tasks not requiring the bells and whistles of a full-blown tightly structured programming language.

Introduction: 

The LiNIX shell program interprets user commands, which are either directly entered by the user, or which can be read from a file called the shell script or shell program. Shell scripts are interpreted, not compiled. The shell reads commands from the script line per line and searches for those commands on the system, while a compiler converts a program into machine readable form, an executable file - which may then be used in a shell script.

A shell is a program that takes commands typed by the user and calls the operating system to run those commands. The shell interprets your commands.

Prospects:

A working knowledge of shell scripting is essential to anyone wishing to become reasonably proficient at system administration, even if they do not anticipate ever having to actually write a script.

A detailed understanding of startup scripts is important for analyzing the behavior of a system, and possibly modifying it. 

A shell script is a quick-and-dirty method of prototyping a complex application. Getting even a limited subset of the functionality to work in a script is often a useful first stage in project development. In this way, the structure of the application can be tested and tinkered with, and the major pitfalls found before proceeding to the final coding in C, C++, Java, Perl, or Python

Shell scripting hearkens back to the classic UNIX philosophy of breaking complex projects into simpler subtasks, of chaining together components and utilities. Many consider this a better, or at least more esthetically pleasing approach to problem solving than using one of the new generation of high powered all-in-one languages, such as Perl, which attempt to be all things to all people, but at the cost of forcing you to alter your thinking processes to fit the tool.

Training 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.

Prerequisite:

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

Agenda:

  • There would be 8 sessions of 2 hours each
  • There would be 8 lab sessions of 6 hours each.
  • After the course is over, You should be able To:
    • write shell scripts using Bash
    • Run and Controlling Scripts with ease
    • Debug shell scripts
    • Do scripting using files, sed, awk efficiently
    • Control processes
    • Handle System Administration

Training Topics in Brief:

  • 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.
Go to Top ^