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 -->
  #3 (permalink)  
Old 05-11-2008
mojoman mojoman is offline
Registered User
 

Join Date: Nov 2007
Posts: 7
Okay now I have this problem...

I have:

Code:
read M
read R
read T
A=`expr $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
When I run the script I get:

mohit@mohit-desktop:~$ ./evaluate_mk
1
2
3
./evaluate_mk: line 6: test: A: integer expression expected
A is 2000 or less
mohit@mohit-desktop:~$

I checked and A is an integer and I made B 2000 so that is an integer. What do I do to fix this problem?
Reply With Quote