Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Write a shell program to add, subtract and multiply the 2 given numbers passed as command line arguments

Posted By: Joao Silva     Category: Unix / Linux / Ubuntu     Views: 9957

Write a shell program to add, subtract and multiply the 2 given numbers passed as command line arguments

Code for Write a shell program to add, subtract and multiply the 2 given numbers passed as command line arguments in Unix / Linux / Ubuntu

add=`expr $1 + $2`
sub=`expr $1 - $2`
mul=`expr $1 \* $2`
echo Addtion of $1 and $2 is $add
echo Subtraction of $2 from $1 is $sub
echo Multiplication of $1 and $2 is $mul
  
Share: 



Joao   Silva
Joao Silva author of Write a shell program to add, subtract and multiply the 2 given numbers passed as command line arguments is from Salvador, Brazil.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!