Aparece $(eval echo \$\{$library_path\})
funciona:
if [ Darwin = 'uname' ]; then
library_path=DYLD_LIBRARY_PATH
else
library_path=LD_LIBRARY_PATH
fi
if [ -z $(eval echo \$\{$library_path\}) ]; then
eval ${library_path}=${thisdir}/lib64:${thisdir}/lib; export ${library_path}
else
eval ${library_path}=${thisdir}/lib64:${thisdir}/lib:$(eval echo \$\{$library_path\}); export ${library_path}
fi
embora possa haver uma solução mais elegante.