Thursday, March 17, 2011

What is a shell script?



There will be many occasions, where the system administrators need to execute the commands in series. For example, you may require providing some input and based on the input you have provided, some command should be executed. In this case, a few commands will be executed in sequence. Those commands can be saved in the same sequence in a plain text file. This sequence of commands kept in a plain text file is called as a shell script.

As we know, there is no importance for the extension of a file (like .xls, .doc). However, administrators usually keep the extension of a shell script file as .sh. For example, file will be named as hello.sh. This is only for the understanding that the file is script file.



A simple example for shell script is given below.

=============================

echo “Enter Your name”

read name

echo “Good Morning, $name”

=============================

When we execute the script,

==============================

Enter Your name

Renjith

Good Morning, Renjith

==============================