In the following, I would like check if a given variable name is set:
$ set hello
$ echo $1
hello
$ echo $hello
$ [[ -z \$$1 ]] && echo true || echo false
false
Since $hello
is unset, I would expect the test to return true
. What's wrong here? I would assume I am escaping the dollar incorrectly.
TYIA