Bash wrongly resolves $USERPROFILE for docker volume
I get the following error when using .sh. It seems to me $USERPROFILE is wrongly resolved. I am not familiar with bash.
fail: Microsoft.Extensions.Hosting.Internal.Host[11] Hosting failed to start System.IO.DirectoryNotFoundException: Could not find a part of the path '/app/C:/Program Files/Git/https/aspnetapp.pfx'.
dotnet dev-certs https --clean
mkdir -p "$USERPROFILE/.aspnet/https"
dotnet dev-certs https \
-ep "$USERPROFILE/.aspnet/https/aspnetapp.pfx" \
-p "this-password-must-be-kept-secret"
dotnet dev-certs https --trust
docker run --rm -it \
-p 5001:5001 \
-e ASPNETCORE_URLS="https://+:5001" \
-e ASPNETCORE_HTTPS_PORTS=5001 \
-e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx \
-e ASPNETCORE_Kestrel__Certificates__Default__Password="this-password-must-be-kept-secret" \
-v "$USERPROFILE/.aspnet/https:/https/" \
mcr.microsoft.com/dotnet/samples:aspnetapp
Interestingly it works with .bat.
dotnet dev-certs https --clean
mkdir "%USERPROFILE%\.aspnet\https"
dotnet dev-certs https ^
-ep "%USERPROFILE%\.aspnet\https\aspnetapp.pfx" ^
-p "this-password-must-be-kept-secret"
dotnet dev-certs https --trust
docker run --rm -it ^
-p 5001:5001 ^
-e ASPNETCORE_URLS="https://+:5001" ^
-e ASPNETCORE_HTTPS_PORTS=5001 ^
-e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx ^
-e ASPNETCORE_Kestrel__Certificates__Default__Password="this-password-must-be-kept-secret" ^
-v "%USERPROFILE%\.aspnet\https:/https/" ^
mcr.microsoft.com/dotnet/samples:aspnetapp
Question
What causes this issue and how to solve it?