Hello to all. Sorry for delayed posting of posts.I was little bit busy in Server settings of RHEL.
So you have in mind what is shell scripting ????
Shell scripts or simply scripts are collection or group of command that are stored in a file.Now you will think what's the use of it ?
Actually it is not possible to run each and every command manually on pc.If this is a repetative job then its again became a headache. So we use Scripting to store those commands and get Outputs. Even we can sheduled the script to run at particular time.
So here we start to write a simple script which will print "Hello World"
Create a file name firstscript.sh [ remember to give it .sh extension ]
Now open any text editor of your choice and write following commands
Step two : Commands [ Below this Command Begin , Description Given after the script is completed ]
# You Can Comment any thing here
# make sure u use a hash in begning
echo "Hello World" # End of Script
First Line should define which shell you are using
there are several shells present in unix system, some of the following are :-
/bin/bash Bash Shell
/bin/sh Bourne Shell
/bin/csh C Shell
/usr/bin/perl Perl Script Shell
/usr/bin/python Python Script Shell
The First Line should start with "#!" Followed by Shell
Then give commands in the file like I've supplied "echo" Command in this script
or you can even give direct commands also
It will give output of date & cal command subsequently and clear screen
You can even provide comment to a command just use a hash "#" in line and it will act as comment
Now question arises how to run this script ???
its very simple
there are two methods
supply following command
Chmod[chmod command change permission of the file] the file to make it executable file
command is as follows
chmod 777 firstscript.sh
and run script by supplying following thing in your commadn terminal
Stay tuned for more articles on shell scripting