The following sub topics we are going to discuss today
- What is a shell script or bash script
- Sample program of shell script
- How to Execute Shell Script
- Explanation of code
What is a shell script or bash script
Computer program or script language designed to be run by the Unix shell using a command-line interpreter is called as shell script
The most basic concept to start with any programming language is hello world , as we are often thought in our school university to create a hello world program in C / C++ programming language tutorial for the beginners or first class , using the same convention and comfortable to begin with the hello world programming language we will create our first program in the shell or bash script using the file name SampleOne.sh for our linux administrator
A shell script file name will end with .sh
A sample program of shell script
create a new file
sampleOne.sh
#!/bin/sh
echo My First Program Hello World is printing on the screen
How to Execute Shell Script
To execute shell script try to open your terminal or ssh shell , navigate to the folder where the script is present and type the following command
sh sampleOne.sh
Explanation of the above code
The first line explains that it should be executed by bin/sh
Here #! is not a comment
Comment format is # , this is a single line comment
Comments
Post a Comment