đź“ť Edit page
âž• Add page
Unset
Define
x=foo
Remove
Set to empty string.
x=''
Unset - remove from variables.
unset x
When doing echo $x
, you won’t see a difference as in both cases it will render as empty string.
Check
From answer
Check a variable is set:
[ -z ${var+foo} ]
Check if a variable is an empty string or not set - it can’t distinguish.
[ -z $foo ]