December 2015
Beginner
306 pages
5h 2m
English
Since we learned basic commands to use Linux OS, we will now write our first Shell script called hello.sh. You can use any editor of your choice such as vi, gedit, nano, and other similar editors. I prefer to use the vi editor.
hello.sh file as follows:#!/bin/bash # This is comment line echo "Hello World" ls date
The #!/bin/bash line is called the shebang line. The combination of the characters # and ! is called the magic number. The shell uses this to call the intended shell such as /bin/bash in this case. This should always be the first line in a Shell script.
The next few lines in the Shell script are self explanatory.
#, will be treated as a comment ...