Comment 3 for bug 1572777

Revision history for this message
Randy (xen2050) wrote :

I think I've got a fix, by changing the test for a negative number to use [[ ]] and a regex to check for only positive numbers (with or without a decimal), and not zero (matching non-zero real numbers in one regex was getting messy). Using this:

if ! [[ "$INTERVAL" != "0" && "$INTERVAL" =~ ^[0-9]+([.][0-9]+)?$ ]]

It will match non-numbers, double-decimals (2.5.3), and any negative signs, and 0. It will also match decimal numbers without a leading zero like .5 , but maybe that's good enough.

It will let fancontrol work with a floating point/decimal INTERVAL without the error message.

I'll attach a patch file for the fancontrol script (not sure if the file names/paths at the top are correct though)

(Another idea was to change the sed call when INTERVAL is assigned, but that wouldn't allow error checking/reporting)

# If earlier patch & my previous 2 comments still appear, please delete them, had errors. Delete this line too :-)