When I run the code below:
if [[ -v xxx ]]; then
echo "OK"
fi
Error happens:
-bash: conditional binary operator expected
-bash: syntax error near `xxx'
It happens in the login shell. When I run
bash
in the same login shell, then run the code above, the error disappears.
The OS is macOs Catalina, shell login command is
login -pf <username> /bin/bash