Expr Command Assignment Help

Assignment Help: >> Advanced Shell Scripts - Expr Command

The expr command

expr - Evaluate expressions

expr command evaluates an expression and writes the result on the standard output screen.  Every token of the expression should be a separate argument.

Numeric expressions

The 'expr' command supports the numeric operators. The numerical operators which are supported in the order raising precedence are +,-,*,/,%.The arguments are coerced to number ( an error can occur if this cannot be completed).

Let consider the following example

# a=10

# b=20

# echo "Addition 'expr $a + $b'// define add method

Addition 30

# echo "Subtraction 'expr $b - $a'// define subtraction method

Subtraction 10

# a=10

# b=20

# echo "Multiplication 'expr $a \* $b'

Multiplication 200

# echo "Division 'expr $b / $a '

Division 2

that gives quotient part

# echo "Modulus 'expr $b / $a'

Modulus 0

that gives remainder part

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd