Bash does not support decimal numbers in arithmetic comparisons. Either convert values to integers or use external tools like 'bc' or 'awk' for decimal calculations and comparisons.
1
2# Noncompliant: Using test command with decimal numbers.
3if [ 0.5 -eq 0.50 ]; then
4 echo "The numbers are equal"
5fi1
2# Compliant: Using `bc` to compare decimal numbers.
3if [[ $(echo "0.5 == 0.50" | bc -l) -eq 1 ]]; then
4 echo "The numbers are equal"
5fi