Just use `ksh` (`ksh93` precisely) or `zsh`, which both natively support floating point arithmetics: $ cat test.ksh #!/bin/ksh min=12.45 val=10.35 if (( $val < $min )) ; then min=$val fi echo "$min" $ ./test.ksh 10.35 Edit: Sorry, I missed `ksh93` was already suggested. Keeping my answer just to make clear the script posted in the opening question can be used with no change outside the shell switch. Edit2: Note that `ksh93` requires the variable content to be consistent with your locale, i.e. with a French locale, a comma instead of a dot must be used: ... min=12,45 val=10,35 ... A more robust solution is to set the locale at the beginning of the script to make sure it will work regardless of the user's locale: ... export LC_ALL=C min=12.45 val=10.35 ...