Skip to content

Files

Latest commit

 

History

History
 
 

shell_script

Shell Scripting

Table Of Contents

1. Basic Shell Scripts

2. Control Structures In Shell

3. Functions

4. Looping structures

5. Make and Makefile

Shell Scripting comprises of two terms:

Shell: In Linux OS, Shell is the interface between CPU kernel and Linux Actor (Users like humans, machine etc.) Linux Shell provides interface via a command line with $ prompt for secondary users and # prompt for root or primary users.

Note: Shell is an interpreter, thus if we specify a set of codes in shell, it will execute all of them one by one even if an intermediate command gives an error/exception.

Linux shell can be of following types:

  1. Bourne Shell (sh)
  2. Bourne Again Shell (bash)
  3. Korn Shell (ksh)
  4. Turbo Shell (tcsh)
  5. C-Shell (csh) etc.

Script: A script in general is a set of code that automatically executes. Scripts can be invoked in following ways:

  1. using triggers
  2. using schedulers like Crontab, Anacron, at etc.
  3. Manual Invocation

Some of the most popular scripting languages are Python, JavaScript and Shell Scripts.

Shell Scripts: Shell scripts are set of codes written in Linux shell to perform following tasks:

  1. Automate the workflow
  2. Perform batch tasks
  3. Perform repetitive tasks
  4. Schedule the tasks using Schedulers like Cron etc.