Tree Tree - 1 year ago 56
Bash Question

How to find whether or not a variable is empty in Bash script

How can I check if a variable is empty in bash?

Jay Jay
Answer

In bash at least:

if [[ -z "$var" ]]

the command man test is your friend.