Advertisement

The If Statement in Linux
Administration Notes

if [ -z "$VARIABLE" ]; then
   echo "Variable is not set"
else
   echo "Varible has value: $VARIABLE";
fi



if [ -n "$VARIABLE" ]; then
   echo "Varible has value: $VARIABLE";
else
   echo "Variable is not set"
fi