- Install the tool
dotnet tool install -g dotnet-script
dotnet-script eval 'Console.WriteLine("Hello world!");'
- Set an example function
function genJwt() { dotnet-script eval 'using System.Security.Cryptography; using System.Text; var rsaKey = RSA.Create(); var privateKey = rsaKey.ExportRSAPrivateKey(); System.Console.WriteLine(Convert.ToBase64String(privateKey));'; }
- Run the function
echo "$(genJwt)"