dotnet / dotnet/sdk

`hash -d` inside `print-env-script` can return exit code 1

Open
#54,690 0 comments 0 reactions 1 assignee Claimed by @dsplaisted View on GitHub
Area-dotnetup untriaged
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Discussed in https://github.com/dotnet/sdk/discussions/54648

Originally posted by **jjonescz** June 9, 2026
I'm trying to use `dotnetup` in CI like this:

```sh
curl -fsSL https://aka.ms/dotnetup/get-dotnetup.sh | bash -s -- --install-dir "$HOME/.dotnetup"
export PATH="$HOME/.dotnetup:$PATH"
dotnetup sdk install
source <(dotnetup print-env-script)
```

(But if there is an easier way, please let me know.)

The problem is that `dotnetup print-env-script` generates `hash -d` commands which apparently can return exit code 1. Hence my script fails (because it has `set -e` like any good script should). I needed to use `source <(dotnetup print-env-script) || true` but that's not a pretty workaround - it could hide other failures.

~Also, btw, does `dotnetup sdk install` has some explicit option to say "install from global.json"? I don't like that it's only implied now.~ - tracked in https://github.com/dotnet/sdk/issues/54692

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.