I just stumbled over a script with works in bash but not in zsh:
if [ Darwin = `uname` ]; then
library_path=DYLD_LIBRARY_PATH
else
library_path=LD_LIBRARY_PATH
fi
if [ -z "${!library_path}" ]; then
eval ${library_path}=${thisdir}/lib64:${thisdir}/lib; export ${library_path}
else
eval ${library_path}=${thisdir}/lib64:${thisdir}/lib:${!library_path}; export ${library_path}
fi
the second if should apparently test, depending on the kernel, if $LD_LIBRARY_PATH
is non zero, or if $DYLD_LIBRARY_PATH
is non zero. And then either set or expand the respective variable.
How would I do the same in zsh? And is there a version that works in zsh and bash?