Skip to content

Commit

Permalink
bash shell for mac os
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanstamenic authored and faniereynders committed Jul 29, 2017
1 parent 093694e commit bb6a84f
Showing 1 changed file with 45 additions and 38 deletions.
83 changes: 45 additions & 38 deletions dotnet-sdk
@@ -1,46 +1,53 @@
#!/bin/bash

@echo off
function sdk_help(){
echo ".NET Command Line SDK Switcher (1.0.0)
if [%1]==[help] goto help
if [%1]==[] goto help
if [%1]==[list] goto sdk_list
if [%1]==[latest] goto sdk_latest
echo Switching .NET Core SDK version to %1
(
echo {
echo "sdk": {
echo "version": "%1"
echo }
echo }
) > global.json
goto end
Usage: dotnet sdk [command]
Usage: dotnet sdk [version]
:sdk_list
echo The installed .NET Core SDKs are:
dir /b "%programfiles%\dotnet\sdk"
goto end
Commands:
latest Swtiches to the latest .NET Core SDK version
list Lists all installed .NET Core SDKs
help Display help
:sdk_latest
if exist global.json del global.json
echo .NET Core SDK version switched to latest version.
dotnet --version
Versions:
An installed version number of a .NET Core SDK"
}

goto end
function sdk_list(){
echo "The installed .NET Core SDKs are:"
ls -1 "/usr/local/share/dotnet/sdk"
}

:help
echo .NET Core SDK Switcher
echo.
echo Usage: .net sdk [command]
echo Usage: .net sdk [version]
echo.
echo Commands:
echo latest Swtiches to the latest .NET Core SDK version
echo list Lists all installed .NET Core SDKs
echo help Display help
echo.
echo versions:
echo An installed version number of a .NET Core SDK
echo.
function sdk_latest(){
if [ -e global.json ]; then
rm global.json
fi

echo ".NET Core SDK version switched to latest version."
dotnet --version
}

:end
case "$1" in
"help")
sdk_help
;;
"")
sdk_help
;;
"list")
sdk_list
;;
"latest")
sdk_latest
;;
*)
echo "Switching .NET Core SDK version to $1"
echo "{
\"sdk\": {
\"version\": \"$1\"
}
}" >> global.json
;;
esac

0 comments on commit bb6a84f

Please sign in to comment.