Tree Tree - 2 years ago 140
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 Source

In bash at least:

if [[ -z "$var" ]]

the command man test is your friend.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download