All about Shell Script
Let's discuss, the Shell script today, I hope by reading this blog, your doubt about the shell script will be gone. So,
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. The different operations performed by shell scripts are program execution, file manipulation and text printing. A wrapper is also a kind of shell script that creates the program environment, runs the program etc.
There are two major types of shells in Unix. These are:
Bourne Shell
This is the default shell for version 7 Unix. The character $ is the default prompt for the bourne shell. The different subcategories in this shell are Korn shell, Bourne Again shell, POSIX shell etc.
C Shell
This is a Unix shell and a command processor that is run in a text window. The character % is the default prompt for the C shell. File commands can also be read easily by the C shell, which is known as a script.
What is shell scripting used for?
Using a shell script is most useful for repetitive tasks that may be time consuming to execute by typing one line at a time. A few examples of applications shell scripts can be used for include: Automating the code compiling process. Running a program or creating a program environment. Completing batch.
Is shell scripting a programming language?
Shell scripting is not a single language but, because it uses some natural language commands, it's easy to learn, even without a programming background. However, each shell scripting dialect is considered a language, and if you plan more complex activities, shells take a lot of practice.
How to write code in shell script?
How to Write Shell Script in Linux/Unix?
Create a file using a vi editor(or any other editor). Name script file with extension .sh.
Start the script with #! /bin/sh.
Write some code.
Save the script file as filename.sh.
For executing the script type bash filename.sh.
What are key words in shell script?
Shell Scripting
Control flow: if, else, then, shell loops, case, etc.
Shell commands: touch, pwd, echo, ls, cd, etc.
Shell keywords: break, if, else, etc.
Write you first Shell script?
It's too easy to write a shell script.Here is the example with ss.
** For information please be in touch on my social.I will daily upload about DevOps tools.
Thanks for reading my blog.
Stay connected with me for learning and sharing.
#90DaysofDevopsChallage #Devops #trainwithsubham.#linux#Day5