Shell Scripting for beginners Part1 covered the execution of a Shell Script on WINDOWS platform with a comprehensive illustration. In this article let us practice shell scripting on LINUX platform. This is done using GNOME-shell for scripting and vim editor for modification and saving of shell scripts.

Open the terminal:  Go to Applications → Accessories → Terminal

Pre-requisite: Installation of GNOME-shell


sudo apt-get install gnome-shell

OUTPUT: It takes a few seconds

[sudo] password for dell:

Reading package lists… Done

Building dependency tree…………..

After this install the vim editor using the command

sudo apt-get install vim

Creation and execution of a simple Shell Script

Let us start by creating a directory called shellscripts using mkdir command and start working there

Navigate to home directory using cd ~ command

cd ~
mkdir shellscripts
cd shellscripts

Now we are inside the shellscripts directory. Now create a new shell script called using the command:


After giving vim command it creates a new file called Press “INSERT” key to start scripting. The shell script starts with a “shabang”. In this program we display the username using $USER variable and echo command as below:

echo "Hello, $USER."

The screen should look as below:

Now save the file using ESC+w+q+! command

Grant permissions for execution of using the chmod command as below:

chmod +x

Execute the shell script using:


The output is as below: