Bash Shell Tutorial Introduction
We are starting the new tutorial series on SHELL SCRIPTS. In this tutorial, we are going to learn the bash (Bourne Shell Script).Bourne Shell is the default shell environment for most GNU/Linux systems. As the end of this tutorial series you will be able to write shell scripts on your own.
First thing we need to do is install putty. Follow this link to install putty.Once the putty is installed. The next step is to connect to the Linux server.
After connecting and login to Linux server or opening and login to a terminal if already on Linux OS, it is usually in the following format:
Where $ represents regular user.
If you login as a root user, prompt is login to look like:
Where # represents the root user, root user is the most privileged user in a Linux operating System.
Now, as we logged in, let`s discuss what a shell script is?
A shell script is a file with a bunch of UNIX commands put together in a file and when you execute or run the file all these commands are executed in a sequence.
Any script on Linux operating system starts with #! followed by the interpreter. So the interpreter for bash can be written as:
We write a shell script in a file named filename.sh and to execute this script to need to provide the executable permission to script using the following command:
chmod a+x filename.sh
Now, the script can be executed as:
Where ./ is the current directory.
Where are are using the full path of the script.
So this introduction tutorial gives you a general idea on what shell scripts are and how to execute them.