EmbLogic's Blog

Shell Script basics

RCS file: script,v
Working file: script
head: 1.34
branch:
locks: strict
akshat: 1.34
access list:
symbolic names:
keyword substitution: kv
total revisions: 34;    selected revisions: 34
description:
Introduction to shell script.
Shells are wrappers around os, shells can act as interface b/w user and kernel.
shells takes the commands entered by user and calls the os to run those commands.
the $ is shell prompt.
Bash is default shell, Every shell has some process id.
we can change the shell by using chsh(change shell command)
—————————-
revision 1.34    locked by: akshat;
date: 2014/04/06 05:25:04;  author: akshat;  state: Exp;  lines: +1 -1
proper spaces are to be given for comparison, eq can also be used for the same.
—————————-
revision 1.33
date: 2014/04/06 05:23:20;  author: akshat;  state: Exp;  lines: +1 -1
conditions are checked.
—————————-
revision 1.32
date: 2014/04/06 05:22:49;  author: akshat;  state: Exp;  lines: +1 -1
:D
—————————-
revision 1.31
date: 2014/04/06 05:21:52;  author: akshat;  state: Exp;  lines: +2 -0
working on elif.
—————————-
revision 1.30
date: 2014/04/06 05:18:57;  author: akshat;  state: Exp;  lines: +3 -1
if else working.
now will work for else if.
—————————-
revision 1.29
date: 2014/04/06 05:17:10;  author: akshat;  state: Exp;  lines: +1 -1
read $3 and then echo $3, confusion :O
—————————-
revision 1.28
date: 2014/04/06 05:07:01;  author: akshat;  state: Exp;  lines: +2 -2
working.
—————————-
revision 1.27
date: 2014/04/06 05:04:41;  author: akshat;  state: Exp;  lines: +1 -1
*** empty log message ***
—————————-
revision 1.26
date: 2014/04/06 04:59:57;  author: akshat;  state: Exp;  lines: +1 -1
conditional statements are working.
goin ahead for else nd ifelse
—————————-
revision 1.25
date: 2014/04/06 04:56:43;  author: akshat;  state: Exp;  lines: +2 -1
if statement uses then nd fi instead of braces.
—————————-
revision 1.24
date: 2014/04/06 04:52:32;  author: akshat;  state: Exp;  lines: +4 -1
using conditional statements in scripts now.
—————————-
revision 1.23
date: 2014/04/06 04:44:24;  author: akshat;  state: Exp;  lines: +2 -4
read is now used in reading directly from command line.
read $3
10 echo  $3
—————————-
revision 1.22
date: 2014/04/06 04:43:05;  author: akshat;  state: Exp;  lines: +1 -0
*** empty log message ***
—————————-
revision 1.21
date: 2014/04/06 04:41:23;  author: akshat;  state: Exp;  lines: +2 -1
echo #$ will give a blank line.
—————————-
revision 1.20
date: 2014/04/06 04:38:36;  author: akshat;  state: Exp;  lines: +1 -0
echo $# will give the list of command line arguments
—————————-
revision 1.19
date: 2014/04/06 04:37:41;  author: akshat;  state: Exp;  lines: +2 -1
echo $$ is used to give pid of script.
—————————-
revision 1.18
date: 2014/04/06 04:35:14;  author: akshat;  state: Exp;  lines: +1 -1
echo -n is used for appending the interpretation in same line.
—————————-
revision 1.17
date: 2014/04/06 04:31:35;  author: akshat;  state: Exp;  lines: +2 -2
echo $* will print all the command line arguments.
—————————-
revision 1.16
date: 2014/04/06 04:30:01;  author: akshat;  state: Exp;  lines: +2 -2
passing second command line argument now.
—————————-
revision 1.15
date: 2014/04/06 04:28:07;  author: akshat;  state: Exp;  lines: +1 -0
command line arguments, How to present these command line arguments in a script.
—————————-
revision 1.14
date: 2014/04/06 04:27:07;  author: akshat;  state: Exp;  lines: +2 -1
line by line taking read.
—————————-
revision 1.13
date: 2014/04/06 04:04:45;  author: akshat;  state: Exp;  lines: +2 -0
read is used for stdin in scripting.
—————————-
revision 1.12
date: 2014/04/06 04:03:09;  author: akshat;  state: Exp;  lines: +1 -1
single inverted commas are interpreted differently.
—————————-
revision 1.11
date: 2014/04/06 04:02:05;  author: akshat;  state: Exp;  lines: +1 -1
:):):):)
—————————-
revision 1.10
date: 2014/04/06 04:00:31;  author: akshat;  state: Exp;  lines: +1 -0
working on more commands :D.
—————————-
revision 1.9
date: 2014/04/06 03:58:37;  author: akshat;  state: Exp;  lines: +2 -1
echo “akshat”$PATH will give various paths, Basically it is predefined macro.
—————————-
revision 1.8
date: 2014/04/06 03:55:29;  author: akshat;  state: Exp;  lines: +1 -1
Script can also be referred to as collection of commands.
Program is collection of statements.
—————————-
revision 1.7
date: 2014/04/06 03:53:27;  author: akshat;  state: Exp;  lines: +2 -2
echo “akshat” $HOME will give the path of home.
—————————-
revision 1.6
date: 2014/04/06 03:52:49;  author: akshat;  state: Exp;  lines: +2 -1
*** empty log message ***
—————————-
revision 1.5
date: 2014/04/06 03:51:12;  author: akshat;  state: Exp;  lines: +1 -1
working on more commands in same script.
—————————-
revision 1.4
date: 2014/04/06 03:46:59;  author: akshat;  state: Exp;  lines: +1 -1
value can be assigned to any variable var1=1 without using space btw variable and =.
—————————-
revision 1.3
date: 2014/04/06 03:45:41;  author: akshat;  state: Exp;  lines: +2 -0
working on more commands in script.
—————————-
revision 1.2
date: 2014/04/06 03:33:25;  author: akshat;  state: Exp;  lines: +3 -0
Echo command is used for printing a string.
—————————-
revision 1.1
date: 2014/04/06 03:30:30;  author: akshat;  state: Exp;
Initial revision
=============================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>