Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

how to compare float values in shell script

# comparing floting points
compare=`echo | awk "{ print ($x < $y)?1 : 0 }"`
echo compare=$compare

if [[ $compare -eq 1 ]]; then
	echo x=$x is less than y=$y
elif [[ $compare -eq 0 ]]; then
	echo y=$y is less than x=$x
fi
 
PREVIOUS NEXT
Tagged: #compare #float #values #shell #script
ADD COMMENT
Topic
Name
6+5 =