Unit 7 Discussion - UNIX / LINUX Operators 1212 unread replies.1616 replies. Topic: In Unix/Linux, Bash Shell operators are divided into various operational functions like defining, evaluating, arithmetic and relational, and redirection operations used by system administrators, for example, the ‘$’ (Dollar sign) in front of a variable is used to evaluate operators. Discuss the best operator for ‘defining’ operators and provide few working examples.
Ans:-
operator description example
+ (Addition) Adds values on either side of the operator expr $a + $b` will give 30
- (Subtraction) Subtracts right hand operand from left hand operand expr $a - $b` will give -10
* (Multiplication) Multiplies values on either side of the operator `expr $a \* $b` will give 200
/ (Division) Divides left hand operand by right hand operand `expr $b / $a` will give 2
% (Modulus) Divides left hand operand by right hand operand and returns `expr $b % $a` will give 0
remainder
= (Assignment) Assigns right operand in left operand a = $b would assign value of b into a
== (Equality) Compares two numbers, if both are same then returns true. [ $a == $b ] would return
false.
!= (Not Equality) Compares two numbers, if both are different then returns true. [ $a != $b ] would return
true.
Unit 7 Discussion - UNIX / LINUX Operators 1212 unread replies.1616 replies. Topic: In Unix/Linux, Bash...