-
Notifications
You must be signed in to change notification settings - Fork 309
Support for zsh in cudaq_set_env.sh #3592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Luca Mondada <[email protected]>
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
I don't understand what/why CI is failing... any ideas? |
Seems like rerun will pass. |
|
This fixes #2194 |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
| # Prefix all paths such that running this script manually for a local installation | ||
| # ensures that the local installation takes precedence over a system-wide installation. | ||
| export CUDA_QUANTUM_PATH=`dirname "$(readlink -f "${BASH_SOURCE[0]}")"` | ||
| export CUDA_QUANTUM_PATH=`dirname "$(readlink -f "${BASH_SOURCE[0]:-$0}")"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do see Bad Substitution error when I run this in zsh
./scripts/cudaq_set_env.sh: 1: Bad substitution
So I tried the following code and it works both in bash and zsh
if [ -n "${BASH_VERSION-}" ]; then
script_path="${BASH_SOURCE[0]}"
elif [ -n "${ZSH_VERSION-}" ]; then
script_path="${(%):-%N}"
else
script_path="$0"
fi
export CUDA_QUANTUM_PATH="$(dirname -- "$script_path")"
Description
Support sourcing the
scripts/cudaq_set_env.shfrom non-bash shells by falling back to$0ifBASH_SOURCE[0]is not defined.Closes #3476