What is Bash Shell Scripting?

Bash

Bash is a scripting language based on the command-line interpreter which is widely available on several operating systems. It is a default command interpreter on most of the Linux systems. A bash is an acronym form of the 'Bourne Again Shell'.

Bash is also said to be a shell program which is an upgraded version of Bourne Shell Program 'sh'. It was written by Brian Fox and released in 1989. It was one of the most popular shell distribution of GNU/Linux based operating systems. A Bash script file is created as a text file with an extension 'sh', which contains a set of commands. These commands are generally a mixture of several commands that we could type on the command line to get the desired result manually. However, we can get the desired result in an automated manner with the help of the Bash Script.

It should be noted that whatever we can run on the command line can also be put into a script, and the result will be the same. Similarly, whatever we can put into a script file can also be run on the command line with the same result.

Bash is the default login shell for most of the Linux based OS and Apple's macOS. It is also made available for Windows 10 with latest releases.

Shell

Shell is a macro-processor which processes the interactive or non-interactive command execution. It is a program or a command-line interpreter which interprets the user commands and then pass them to the Operating Systems for processing. These commands may be either entered by the user directly or read from a file such as shell scripts. It is an important thing to remember that shell are not compiled, they are directly interpreted in order to perform the execution.

In another way, the shell is a terminal window which allows us to make use of commands to interact with our computer to perform operations such as retrieving or storing the data, processing information and various other simple or complex tasks.

Linux has several built-in shells. Some of them are:
  • Bourne Shell
  • C Shell
  • Korn Shell
  • GNU Bourne Shell
To check, which shell type your OS has; simply type the below command into the terminal:
cat/etc/shells
To locate the Bash in your OS, type the below command:
which bash 
Check out the screenshot below that shows the shell type of my Linux (Ubuntu) and a location of Bash Shell:
Bash Commands

Scripting

Scripting is the method of automatic commands execution which may have executed interactively one-by-one. Assume, we have many commands that we need to execute every day. This will be a little bit tedious task on a daily basis so we can put all the commands together in a file to execute them easily. Those commands will be executed automatically just by running the script file. Thus, any shell interaction can be made automated and scripted with the help of scripting mechanism.
Following topics will clear all the doubts about scripting, so just keep reading further topics to get a better understanding.

←prev next→



Tutorial Highlights



Subscribe To Get All The Latest Updates!


Latest Tutorial



Blog with us

CONNECT WITH US

Like Tutorialsmate on Facebook Follow Tutorialsmate on Facebook Add Tutorialsmate on Facebook Subscribe Tutorialsmate on Facebook Follow Tutorialsmate on Facebook Follow Tutorialsmate on Facebook
Get tutorialsmate on Google Play
© 2020 TutorialsMate. Designed by TutorialsMate