How to check if null in bash

Expanding on the previous bash not null post to check if a string is null

String='' # Zero-length ("null") string variable. 

if [ -z "$String" ] 
 echo "\$String is null." 
 echo "\$String is NOT null." 
fi # $String is null. 

Justin Kelly

Justin Kelly

Data Engineeer, Business Analytics, Web Developer, Library Technology specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly