The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



Thread: Simple Script
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-11-2008
mojoman mojoman is offline
Registered User
 

Join Date: Nov 2007
Posts: 7
Simple Script

Hello,

I am new to shell scripting. I am running UBUNTU at work and using BASH.

I have this script:

Code:
read M
read R
read T
A=$M+$R+$T
B=2000
if test A -gt B
then
   echo "A is greater than 2000"
else
   echo " A is 2000 or less"
fi
All I am trying to do is to add M, R and T arithmetically and store them in A and then I have to check if A is greater than 2000. If I have A=1 and B=2 and C=3 the value of A is equal to "1+2+3" and not six....

What do I have to do to fix the problem? I feel silly asking this question here but I have looked in books and on the web and what I try does not seem to work.
Reply With Quote
Forum Sponsor