May 2018
Beginner
332 pages
7h 28m
English
Since we have learned basic commands in the 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, emacs, geany, and other similar editors. I prefer to use the vi editor:
#!/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 sequence. 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: