Zsh: export: not valid in this context
20
votes
3
answers
103480
views
When running [this script](https://gist.github.com/amelio-vazquez-reina/0befbd311e96f8787754) , I run into an error on this line (relevant snippet below):
...
_NEW_PATH=$("$_THIS_DIR/conda" ..activate "$@")
if (( $? == 0 )); then
export PATH=$_NEW_PATH
# If the string contains / it's a path
if [[ "$@" == */* ]]; then
export CONDA_DEFAULT_ENV=$(get_abs_filename "$@")
else
export CONDA_DEFAULT_ENV="$@"
fi
# ==== The next line returns an error
# ==== with the message: "export: not valid in this context /Users/avazquez/anaconda3"
export CONDA_ENV_PATH=$(get_dirname $_THIS_DIR)
if (( $("$_THIS_DIR/conda" ..changeps1) )); then
CONDA_OLD_PS1="$PS1"
PS1="($CONDA_DEFAULT_ENV)$PS1"
fi
else
return $?
fi
...
Why is that? I found this ticket , but I don't have that syntax error.
I found reports of the same problem in GitHub threads (e.g. here ) and mailing lists (e.g. here )
Asked by Amelio Vazquez-Reina
(42851 rep)
Jun 10, 2015, 02:11 AM
Last activity: Apr 18, 2025, 07:14 PM
Last activity: Apr 18, 2025, 07:14 PM