You are currently viewing Shell Scripting – Getting Started
Shell Scripting – Getting Started

Shell Scripting – Getting Started

  • Post author:
  • Post category:Linux

Shell Scripting – Getting Started

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In this blog series, we will explore one of the most commonly used scripting languages, shell scripting. A shell script, in a nutshell, is basically a grouping of multiple commands to get executed in the shell of Unix/Linux/POSIX-compliant operating systems. You execute a command or a set of commands through shell which intern interacts with the system kernel and give you the output of execution.

Shell Scripting – Getting Started

Kernel-Shell:

A kernel is the core of any operating system that acts as an intermediate between system hardware and software. A shell on the other hand links between the kernel and end-users. Together they achieve the most common day to day work of an operating system.

Hardware: Hardware consists of all physical devices attached to the System. For example Hard disk drive, RAM, Motherboard, CPU, etc.

Kernel: Kernel is the core component for any Unix/Linux/POSIX-compliant operating system which directly interacts with the hardware.

Shell: Shell is the interface that takes input from Users and sends instructions to the Kernel, also takes the output from Kernel, and sends the result back to output shell.

Applications: These are the utility programs that run on Shell. This can be any application like Your web browser, media player, text editor, etc.

Major Types Of Shell:

Bourne shell (sh): Developed by Stephen Bourne at Bell Labs, it was a replacement for the Thompson shell, whose executable file had the same name—sh. It was released in 1979 in the Version 7 Unix release distributed to colleges and universities. Although it is used as an interactive command interpreter, it was also intended as a scripting language and contains most of the features that are commonly considered to produce structured programs.

C shell (csh): The C shell (csh or the improved version, tcsh) is a Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s. It has been widely distributed, beginning with the 2BSD release of the Berkeley Software Distribution (BSD) which Joy first distributed in 1978.

KornShell (ksh): ksh is a Unix shell that was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983. The initial development was based on the Bourne shell source code. Other early contributors were Bell Labs developers Mike Veach and Pat Sullivan, who wrote the Emacs and vi-style line editing modes’ code, respectively. KornShell is backward-compatible with the Bourne shell and includes many features of the C shell, inspired by the requests of Bell Labs users.

Bourne-again shell (bash): GNU Bash or simply Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been used widely as the default login shell for most Linux distributions and Apple’s macOS Mojave and earlier versions.

Tee Cee Shell (tcsh): tcsh is a Unix shell based on and compatible with the C shell (csh). It is essentially the C shell with programmable command-line completion, command-line editing, and a few other features. Unlike the other common shells, functions cannot be defined in a tcsh script and the user must use aliases instead (as in csh). It is the native root shell for BSD-based systems such as FreeBSD.

Shell Script Components:

Shebang: The #! syntax used in scripts to indicate an interpreter for execution under UNIX / Linux operating systems.

Command: The actual command that will be executed in your script.

Comment: The # syntax used in the scripts to indicate a comment. The shell ignores any line beginning with # with one exception of shebang.

Shell Scripting – Getting Started:

Hope you have enjoyed this blog post. In the next blog post, we will discuss special characters in the shell.