简体   繁体   中英

Using F# as replacement for Linux shell scripting

After learning f# I would also like to use f# as a replacement for shell (bash,sh) scripting. Is there anyone having experience using f# for this purpose?

Do there exist f# Linux system libraries with functions like?:

  • ismountpoint(path)
  • processlist
  • killprocess
  • other system interface functions

As far as I know there are no specific libraries for Linux but you can make use of System.Diagnostics as below to get processes and also to Kill (with care):

let main args =
    let procs = System.Diagnostics.Process.GetProcesses()
    for proc in procs do
        printfn "%i: %s" proc.Id proc.ProcessName
        proc.Kill() |> ignore
    0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM