a - what is a shell script shell script is a sequence of commands written in plain text file that is executed by Unix or Linux shell This script automates the execution of tasks and can be used for a variety of purposes Purpose β helps automate repetitive tasks, making them faster and less error-prone Interpreted language βis interpreted by the shell (like bash), not compiled. Command-based β consists of a series of commands that can be run manually in the terminal. Extensibility β can include control structures like loops, conditionals, and functions. Portability β can often be made portable across different Unix-like systems. common uses: automation, deployment, system administration
b - How to write a shell script Step 1 β open a text editor (nano, vim, gedit, vi, kate etc) Step 2 β add the Shebang Line. It tells the system which interpreter to use Step 3 β write your script Step 4 β save and exit Step 5 βmake the script executable Step 6 β run the script In a shell script you can have variables, conditional statements, functions... You can also take input from the user.