DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login
IT Tags
DiigIT » Oracle »

Shell script problem...

By: rekha singh | 31 Aug 2010 4:16 pm

Hi All,

I have problem in the following shell script (problem in 2and3 line i guess)
#!/bin/sh
set value1 = 90;
set value2 = 70;
if [ $value1 > $value2 ]; then
echo "$value1 is normal"
else
echo "$value2 is abnormal"
fi

when executed
output:
$ value_test.sh (Enter)
is abnormal
Neither it's printing the $value1,nor it's displaying correct output.but no errors.
It is not atall executing the loop properly and jumps to else directly.

I guess the problem is with Set value command..
i guess it's wrong.... pls let me know the correct command.

Thanks
 

Comments

hi

try using let instead of set.
 

By: rekha singh | 31 Aug 2010

try this:

value1=90
value2=70
if expr [$value1>$value2]
then
echo $value1 is normal
else
echo $value2 is abnormal

 

By: rekha singh | 31 Aug 2010

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move