Posts

Showing posts from June, 2012

Shell Basic Operators.

There are various operators supported by each shell. There are following operators which we are going to discuss: Arithmetic Operators. Relational Operators. Boolean Operators. String Operators. File Test Operators. The Bourne shell didn't originally have any mechanism to perform simple arithmetic but it uses external programs, either  awk  or the must simpler program  expr . Here is simple example to add two numbers: #!/bin/sh val=`expr 2 + 2` echo "Total value : $val" This would produce following result: Total value : 4 There are following points to note down: There must be spaces between operators and expressions for example 2+2 is not correct, where as it should be written as 2 + 2. Complete expresssion should be enclosed between  `` , called inverted commas. Arithmetic Operators: There are following arithmatic operators supported by Bourne Shell. Assume variable a holds 10 and variable b holds...