Wednesday, April 9, 2025

Today's Bash Question

This should not be this hard. I want to do a while loop on the condition "$xstart  < $xend"

while [ "$xstart < $xend" ]

do

...

done

I know that to do a float compare, I need something like 

echo "$xstart > $xend" | bc -l 

returning a boolean.

Found it:

    while [ "$(bc <<< "$xstart < $xend")" == 1 ];

No comments:

Post a Comment