2013-12-30

Shell script

Pranaam to all bhai ji _/\_
Today we are going to discuss about shell scripting
most of us is familiar with word "shell scripting/bash scripting". This is nothing but just linux commands written in a file and when we execute that file via Linux terminal, commands execution starts one by one .

Usage of shell script:-
---> shell script is basically used for automation of tasks or if you need to run commands again and again

Basic shell script:-
so lets start with shell scripting......
Linux shell terminal is the user interface through which user run commands and shell terminal forward those commands to kernel for processing , after processing kernel return result to shell terminal and we can see the output of command on shell terminal
for example , write this on your shell terminal
echo "pranaam bhai ji _/\_"
and press enter
it will print message  pranaam bhai ji _/\_  on screen


we can do this using shell script too , how ........ lets start ^_^
we will use vi file editor for file writing/editing
here is link for basic usage of vi file editor http://www.mannulinux.org/2013/08/vi-file-editor-in-linux.html

for a shell script , we  just need to specify list of commands that we want to run via terminal
create a file with .sh extension , like ica.sh :p
i want to print "pranaam bhai ji _/\_" on terminal using shell script. as mentioned earlier , we need to write command in file
i used echo "pranaam bhai ji _/\_"  when i was using terminal so write the same command in ica.sh file


save this file and run
for running .sh file, we have 2 ways
one is to use command
sh shell_script.sh



here sh is the shell terminal binary (/bin/sh) you can also use command
bash  shell_script.sh


bash is also a shell terminal binary (/bin/bash)
second is
make shell script file executable by using chmod command 
and then ./shell_script.sh



here ./ means current directory, But only . (dot) means execute given command file in current shell without starting the new copy of shell.
so here goes our very first tutorial on shell scripting . we will study more about shell script in our next tutorial
Thank you

Greetz to :- Guru ji Zero , code breaker ica, Aasim shaikh,Reborn, Raman kumar rana,INX_r0ot,Darkwolf indishell, Chinmay Pandya ,Silent poison India,Magnum sniper,Atul Dwivedi,ethicalnoob Indishell,Local root indishell,Irfninja indishell,Hardeep bhai,Mannu,Viki and AR AR bhai ji <3



Share this post
© 2009 Start With Linux | Mannu Linux
Designed by cyb3r.gladiat0r
Posts RSSComments RSS
Back to top