Execulte simple shell scripts with F#
You can install using dotnet package manager:
dotnet add package Shellfs
Another approach is importing in Fsharp Script (fsx):
#r "nuget: Shellfs, 0.0.2"
open Shellfs
// Execute command with output on console
Shell.Exec "echo Hello" |> fun x -> x.Result
// Exec running asynchronously
// Ok { ExitCode = 0
// StandardOutput = "Hello"
// StandardError = "" }
Shell.Exec "invalidCommand" |> fun x -> x.Result
// Error "An error occurred trying to start process 'invalidCommand' with working directory"
// Execute command with slent mode (default is false)
Shell.Exec ("echo hello", silent=true)
// Execute command in specific directory (Default value is current directory)
Shell.Exec ("ls -l", dir=dir)
// It's possible exec command synchronously
Shell.ExecSync ("ls -l", dir=dir)
This project is in early stages.
- Exec commands synchronously
- Exec commands with tasks
- Add basic UNIX commands