Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/cudaq_set_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# 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}")"`
Copy link
Collaborator

@sacpis sacpis Nov 20, 2025

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")"

export PATH="${CUDA_QUANTUM_PATH}/bin${PATH:+:$PATH}"
export LD_LIBRARY_PATH="${CUDA_QUANTUM_PATH}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export CPLUS_INCLUDE_PATH="${CUDA_QUANTUM_PATH}/include${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}"
Loading