2. Control Structures In Shell
Shell Scripting comprises of two terms:
Shell: In Linux OS, Shell is the interface between CPU kernel and Linux Actor (Users like humans, machine etc.) Linux Shell provides interface via a command line with $ prompt for secondary users and # prompt for root or primary users.
Note: Shell is an interpreter, thus if we specify a set of codes in shell, it will execute all of them one by one even if an intermediate command gives an error/exception.
Linux shell can be of following types:
- Bourne Shell (sh)
- Bourne Again Shell (bash)
- Korn Shell (ksh)
- Turbo Shell (tcsh)
- C-Shell (csh) etc.
Script: A script in general is a set of code that automatically executes. Scripts can be invoked in following ways:
- using triggers
- using schedulers like Crontab, Anacron, at etc.
- Manual Invocation
Some of the most popular scripting languages are Python, JavaScript and Shell Scripts.
Shell Scripts: Shell scripts are set of codes written in Linux shell to perform following tasks:
- Automate the workflow
- Perform batch tasks
- Perform repetitive tasks
- Schedule the tasks using Schedulers like Cron etc.