Shell Script Basic information


  • It is a normal ascii textile with sequence or group of commands.
  • Shell Script executes one by one in order to a result.
  • Shell is a unique program that provides the user an interface to interact with kernel accepting human-readable commands and then converts it to kernel understandable language. Shell, in a Linux operating system, can take input from the user in the form of commands, processes it, and then displays an output. You can access Shell using Terminal in Linux.



Shell has two categories:

  1. Command-Line Shell
  2. Graphical Shell

Command-Line Shell

A shell can be accessed by a user using command-line interfaces. We have programs like the terminal in (Linux or Mac) and Command Prompt in Windows to get input in the form of human-readable commands and then display output in the same command-line interface.

Graphical Shell

Graphical shell provides users a Graphical User Interface (GUI) to interact, perform operations like opening, closing, saving files. Windows OS and Ubuntu are great examples of GUI Shell (Desktop), where a user does not have to type commands for every operation. Still, behind every action, there is a shell command that executes to perform these actions.


What is BASH Shell?

BASH (Bourne Again Shell) is the default command-line interpreter for most of the Linux Distros these days. It is an updated version of the earlier Bourne shell. If you are a Linux system administrator or a power user, you must have excellent knowledge of BASH shell commands to perform day to day tasks.


What is BASH Scripting?

Mostly we use shell commands one by one in the terminal for our everyday tasks. Still, sometimes you have to perform complex tasks or repetitive tasks, which involves a series of commands being executed in a proper sequence. A shell can also take commands as input from a file, so to make our job easy, we can write these commands in a file and can execute them in the shell to avoid manual work. These files are called shell scripts.


---------------------------------------------------------------------------------------------
Advantages of Shell script
---------------------------------------------------------------------------------------------
  • Managing users will become easy
  • Managing system performance will become very easy.
  • Taking backups will become easy and simple.
  • Automate the jobs daily or periodically using shell script
  • devolop text based interface.


---------------------------------------------------------------------------------------------
Dis Advantages
---------------------------------------------------------------------------------------------
we can not devolop GUI based applications by using shell script.
It is a platform dependent.


---------------------------------------------------------------------------------------------
Execution steps for Shell script:
---------------------------------------------------------------------------------------------

  • sh script_file.sh
  • exec script_file.sh
  • source script_file.sh
  • ./script_file.sh


---------------------------------------------------------------------------------------------
Shell Keywords:
---------------------------------------------------------------------------------------------

Echo,if,read,else,set,fi,unset,while,readonly,do,shift,done,export,for,until,trap,case,wait,esac,eval,break,exec,continue,ulimit,exit,umask,retun