Logo 
Search:

Unix / Linux / Ubuntu Articles

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

Write a shell program to exchange the values of two variables

Posted By: Vilmos Fischer     Category: Unix / Linux / Ubuntu     Views: 4210

Write a shell program to exchange the values of two variables.

Code for Write a shell program to exchange the values of two variables in Unix / Linux / Ubuntu

echo Enter valuefor a:
read a
echo Enter valuefor b:
read b
clear
echo Values of variables before swaping
echo A=$a
echo B=$b
echo Values of variables after swaping
a=`expr $a + $b`
b=`expr $a - $b`
a=`expr $a - $b`
echo A=$a
echo B=$b
  
Share: 



Vilmos Fischer
Vilmos Fischer author of Write a shell program to exchange the values of two variables is from Frankfurt, Germany.
 
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!