Could someone please explain why this works, specifically the fact that I am not using ‘$’ character before the names of the variables inside the if statement? I have searched the Bash Reference Manual, but could not find an explanation.
#!/usr/bin/env bash
one="$1"
two="$2"
three="$3"
four="$4"
if [[ one -le two ]] && [[ three -ge four ]]; then
echo "TRUE: $one <= $two && $three >= $four"
else
echo "FALSE: $one <= $two && $three >= $four"
fi
I have also tested it with a loop like this, which works perfectly
for x1 in {1..3}; do
for x2 in {1..3}; do
for x3 in {1..3}; do
for x4 in {1..3}; do ./test $x1 $x2 $x3 $x4;
done; done; done; done | sort