I am doing
local w="" if [[ -v "$w" ]]; then echo printf '%s\n' "VARIABLE SET TEST" printf '%s\n' " w=\"$w\" | w: $w" printf '%s\n' \ " [[ -v \"\$w\" ]] TRUE, w is not set to a value by assignment" printf '%s\n' \ " [[ ! -v \"\$w\" ]] FALSE, w is not set to a value by assignment" fi [[ -v "$w" ]] should return True if the shell variable is set (has been assigned a value). But this is returning false.
-v varnamenot its value-v "$varname"I think?$varnamethat I want.if test "${w+x}"(or equivalentlyif [ "${w+x}" ]). Cutely,if ${w+true} falseif [ "${w+false}" ].