Based on the official Microsoft documentation with a bit of sketchiness added in for convenience:
echo -ne "\033[0;31mdotnet-install:\033[0m Enter the .NET Core SDK channel (i.e. n.n, not n.n.n) you would like to install: " && read CHANNEL; curl -sSL https://dot.net/v1/dotnet-install.sh | bash -s -- --channel "${CHANNEL}" && grep -qxF 'export PATH=$PATH:$HOME/.dotnet' ~/.zshrc || echo 'export PATH=$PATH:$HOME/.dotnet' >> ~/.zshrc && source ~/.zshrc
This does the following:
- Prompt the user to enter a .NET Core SDK version to install
- Install the entered .NET Core SDK version
- Add the dotnet path to
~/.zshrc
file so that you can actually use it - Source the
~/.zshrc
file so you can start using it
Just run dotnet --info
to make sure everything is goo, and you be ready to rock!
Note: You may need to replace the --channel n.n
switch with --version n.n.n
if you want to install a specific version of the SDK.