I would like to create an environment variable which is an "alias" of another environment variable. i.e. whenever the original variable changes, this alias variable changes with it. How do I do this in a robust way?
The exact situation for me is this: I use conda environments, which use an environment variable CONDA_DEFAULT_ENV that changes when you change environment. I would like an environment variable called VIRTUAL_ENV to be set and updated equal to CONDA_DEFAULT_ENV any time it changes.
Note that I'm using zsh on MacOS.
VIRTUAL_ENV() { echo "$CONDA_DEFAULT_ENV"; }Then use it like"$(VIRTUAL_ENV)"instead of"$VIRTUAL_ENV"typeset -T CONDA_DEFAULT_ENV VIRTUAL_ENV ''orVIRTUAL_ENV=CONDA_DEFAULT_ENV+${(P)VIRTUAL_ENV}when expanding).