true and false not built-in keywords for boolean in bash in the same way as for other programming languages
You can simulate checking the true / false state of a variable as follows:
cond1="true" cond2="false" if [ "$cond1" = "true" ]; then echo "First condition is true" fi if [ "$cond2" = "false" ]; then echo "Second condition is false" fi
When you do:
if [ false ]
It implicitly translates to
if [ -n "false" ]
Where -n means "test if the length of this length is greater than 0: logically true, if so, logically false otherwise"
Next to it, true and false really do something, but these are the commands:
man true man false
More about them.
sampson-chen
source share