bash boolean code example
Example 1: bash test boolean
the_world_is_flat=true
# ...do something interesting...
if [ "$the_world_is_flat" = true ] ; then
echo 'Be careful not to fall off!'
fi
Example 2: boolean constants in bash
true, false
Example 3: return boolean bash
#!/bin/bash
isdirectory() {
if [ -d "$1" ]
then
true
else
false
fi
}
if isdirectory $1; then echo "is directory"; else echo "nopes"; fi