How to find if a bash variable is empty?

If you want to know if a bash variable is empty , there are multiple ways to do it and this blog post explains how to do with the recommended way.

How to determine if a bash variable is empty?

if [ -z "${VAR}" ];

The above code snippet returns trus if a variable is unset (called null in programming terms) or if it is set to empty string.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

When testing your app in the Windows Phone 8 Emulator, the developers may want to see how the application behaves...
If you are looking out for different ways to right click on Mac , here are some of the ways...
The holiday season is a time for joy, family gatherings, and unfortunately, a notable increase in scams. As Christmas approaches,...