VAR=’hello’
if [ -n ‘$VAR’ ]; then
echo ‘VAR is not empty’
fi
Similar, el operador -z chequea si la cadena es null, ejemplo:
VAR=»
if [ -z ‘$VAR’ ]; then
echo ‘VAR is empty’
fi
VAR=»
if [ -z ‘$VAR’ ]; then
echo ‘VAR is empty’
fi