What's a Shell Script?
A shell script does not require any compilation in order to run, making them quite useful & easy to use.
Unlike larger programs like LiberOffice or Word for example, which both need to be compiled into an executable before they can run on a given Operating System.
All Linux systems have a shell, most often running a version of Bash (Bourne Again SHell) as there default shell.
The term Shell Script is only really used to refer to scripts running on a Unix/Linux Operating system, Scripts written for Windows for example are usually called batch files.
If you open up a terminal window in Linux and issue 'echo $SHELL' you should see what shell you're running.
Getting StartedThe guide assumes that you're using some variant of Linux as your operating system and that you know how to start and use the terminal and a text editor for your given distribution.
Writing your first shell script is really easy all you need to do is open up your favourite text editor which can either be a command line or graphical editor and then start typing.
Below is an example of a working shell script:
#This is a comment.
echo "Hello World";
Save the above text into a text file called MyShellScript.sh (use your favourite editor) into your home directory. Next using the command line, issue chmod +x to make the file executable.
chmod +x MyShellScript.sh
Now run it using the command line
The output should read. 'Hello World'
Congratulations! You've just created and executed you very first shell script.