Results 1 to 4 of 4
hi i am trying to comapre numbers for the biggest
among double type of numbers. ie
0.254
0.255
0.564
0.984
0.556
0.6566
0.5666
with this if statement
if [ $max ...
- 12-08-2006 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 5
if [ ]
hi i am trying to comapre numbers for the biggest
among double type of numbers. ie
0.254
0.255
0.564
0.984
0.556
0.6566
0.5666
with this if statement
if [ $max -lt $i ]
if [ "$max -lt "$i" ]
they all give this error message
1. [: 0.37: integer expression expected
2. [: 0.40: integer expression expected
in that order
but none is working. Plaese help
- 12-08-2006 #2Just Joined!
- Join Date
- Dec 2006
- Posts
- 52
Try
if [ "$max" -lt $i ]
- 12-08-2006 #3Just Joined!
- Join Date
- Dec 2006
- Posts
- 5
but ...
yes but the same ols errors exist
[: 0.39 : integer expression expected
- 12-08-2006 #4Just Joined!
- Join Date
- Dec 2006
- Posts
- 5
reply
i think if the numbers were to be normal whole numbers ( not double as in other programming languages) it would have worked alright.
is there any way to handle such type of number with decimal points ( . ) in shell.


Reply With Quote