Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 514 Bytes

dotnet-scripts.md

File metadata and controls

26 lines (18 loc) · 514 Bytes

dotnet scripts

  • Install the tool
dotnet tool install -g dotnet-script

simple example

dotnet-script eval 'Console.WriteLine("Hello world!");'

set a bash function

  • 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)"