While creating an automated cleanup script on a Linux server, a systems administrator stores the amount of free RAM (in MB) in a variable named free_mem. The script must stop the PostgreSQL service only when the available memory drops below 512 MB. The administrator begins the conditional block as follows:
if [[ $free_mem ____ 512 ]]; then
systemctl stop postgresql
fi
Which comparator should replace the blank so the condition works as intended?
In Bash, the [[ ]] test command uses the -lt operator for numeric "less-than" comparisons. Substituting -lt makes the condition true only when the integer stored in free_mem is lower than 512, correctly triggering the service stop.
-le would also evaluate numbers, but it would fire when memory is exactly equal to 512 MB, which violates the requirement.
-gt looks for values greater than the threshold and would never run the shutdown when memory is low.
< is treated as a lexicographical string comparison inside [[ ]], so it could produce incorrect results when comparing integers such as 100 and 99.
Therefore, -lt is the only choice that provides the required numeric "less-than" test inside the double-bracket conditional.