#String

if [[ -z "$string" ]]; then
    echo "String is empty"
elif [[ -n "$string" ]]; then
    echo "String is not empty"
else
    echo "This never happens"
fi

#Combinations

if [[ X && Y ]]; then
    ...
fi

#Equal

if [[ "$A" == "$B" ]]; then
    ...
fi

#Regex

if [[ '1. abc' =~ ([a-z]+) ]]; then
    echo ${BASH\_REMATCH[1]}
fi

#Smaller

if (( $a < $b )); then
   echo "$a is smaller than $b"
fi

#Exists

if [[ -e "file.txt" ]]; then
    echo "file exists"
fi
Comments