Determine if a bash variable is empty
We can check the length of the variable to determine if its empty or not. Here, I've used an inverse condition. If its not null it prints the value of the variable else it prints that "It's empty".
[[ ! -z "$myVar" ]] && echo myVar is $myVar || echo ...
arsalanz.hashnode.dev1 min read