Shell Script Tutorial
What is Shell Script
A shell script is a list of commands in a computer program that is run by the Unix shell which is a command-line interpreter. A shell script usually has comments that describe the steps.
- Allow you to run if-else statements and loops.
- A file that contains a series of commands.
- A plain text file.
- It executes the command on each line, one line at a time.
- The terminal usually allows just one command at a time.
- Shell script allows you to combine and run multiple commands together
When do we need a shell script?
- You need to enter multiple shell commands and you will need to do it again in the future.
- If you know how a piece of work need to perform.. you can put that knowledge in a shell script
- ShellScript eliminates repetitive tasks through automation.
- Using a good script can reduce the change of error.
- A shell script can perform a task faster than a human can.
- You have to do a task more than once, but it's something that you rarely do.
Why use Shell
- Speed of deployment
- No worrying about low-level programming objects.
- Ease and speed of learning.
- Performance and efficiency.
- Anything you can do on the command line can be automated by writing a shell script.
- Can automate tedious or repetitive tasks.
- allow you to hand off work to others.
- Act as a form of documentation.
- Fairly quick and easy to write.