Lecture # 2 - Introduction to Shell Scripting
What is Shell Scripting? Why use Shell Scripting?
Shell Scripting:
Shell scripting refers to writing scripts or programs using shell commands and syntax to automate tasks or perform operations within a Unix-like operating system's shell environment. In Linux, the most commonly used shell for scripting purposes is Bash (Bourne Again Shell), although other shells like Zsh, Ksh, and Csh can also be used.
Why Use Shell Scripting:
Task Automation:
Shell scripts can be used to automate complex tasks involving multiple commands, conditionals, loops, and other control structures. This enables users to streamline workflows, improve productivity, and reduce the likelihood of errors.
Network Automation:
Shell scripts automate network configuration and management tasks such as setting up network interfaces, configuring firewalls, and managing routing tables.
Shell vs. sh vs. bash:
Shell:
The program that interprets and executes the various commands that we type in the terminal.
sh:
- Bourne Shell -
/bin/sh
bash:
Bourne Again Shell -
/bin/bash
Improved version of sh.
default shell program for most UNIX like systems.
Bash is a shell program.
Bash is a programming language.