Conditional Expression for variable is not working in ZSHVER=5.9

24 views Asked by At

Any idea why -v is not working in version 5.9?

% unset foo;

% [[ -v foo ]] && echo "foo";
zsh: unknown condition: -v

Directly from section "12 Conditional Expressions" in the docs...

-v varname true if shell variable varname is set.

UPDATE: I have whittled it down to something in my environment. If I start a new shell, it works as expected. No differences with setopt settings or zsh version. I resourced my dot files in the new shell with no luck.

If it start a new shell, then from that shell start an new xterm, then I have the same problem in the new xterm, so this feels like a problem with how the shell is starting in new xterms.

1

There are 1 answers

0
LanceMc On

Bind key for opening an new xterm was pointing the shell to an older version; everything else on the system is pointing to 5.9. I should have started with $ZSH_VERSION from the beginning...

% echo $ZSH_VERSION
5.0.2

Feature I was using was not part of ZSH until version 5.3.