2020-01-01 01:11:49 +0000, Hongyi Zhao:
[...]
> replacement = 'VIRTUAL_ENV="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"'
>
>
> But it only valid for bash, I also want to do the corresponding
> replacement for zsh/fish/csh/Xonsh. How should adapt the replacement
> expression for my case?
[...]
The zsh "equivalent" of bash's
VIRTUAL_ENV="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
Which AFAICT is meant to get you the path of the parent
directory of the script's parent directory
Would be something like:
VIRTUAL_ENV=$0:a:h:h
See also $0:P:h:h where $P is the "realpath" (canonical absolute
path) of $0.
--
Stephane