Tag Archives: param

How to check if a variable is set in Bash?

where ${var+x} is a parameter expansion which evaluates to nothing if var is unset, and substitutes the string x otherwise. To check for non-null/non-zero string variable, i.e. if set, use It’s the opposite of -z. I find myself... Read More | Share it now!