How to check a variable for empty and a newline

I have a variable with a new line. I want to check this variable for empty or a new line

Can anyone advise

if [ -z "`echo "$VARIABLE" | tr -d '\n'`" ]; then
    ...
fi

Is this what you mean?

case $var in 
  ""|*"\n"*) echo hello
esac

You are testing for a literal '\n', not a newline.

NL='
'
case $var in 
  ""|*"$NL"*) echo hello
esac

Oww, that's right, thanks!\n :slight_smile: