When activating a qiime2 2018.11 conda environment from within a bash script that has the
-u option activated, q2cli’s tab completion hook raises the following error message:
$HOME/miniconda3/envs/qiime2-2018.11/etc/conda/activate.d/50_activate_q2cli_tab_completion.sh: line 1: ZSH_VERSION: unbound variable
Note: the bash
-u option (“nounset”) raises an error when an undefined variable is attempted to be used.
Here’s a minimal script to reproduce the error (tested on macOS):
#!/usr/bin/env bash set -u source activate qiime2-2018.11
The error message doesn’t occur if
-u is turned off before activating the conda environment:
#!/usr/bin/env bash set -u set +u source activate qiime2-2018.11 set -u
It’s probably a simple fix to how
ZSH_VERSION is referenced in
50_activate_q2cli_tab_completion.sh. Just wanted to note the issue and a workaround in case anyone else runs into it. Thanks!