How to invoke bash or shell scripts from a haskell program?

前端 未结 4 2299
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 22:16

I\'m writing some shell scripts with haskell, which I\'m running in gitbash, but there are a few other existing scripts I\'d like to be able to use from those scripts.

4条回答
  •  时光取名叫无心
    2020-12-29 23:05

    Yes, it is possible. You can use process package, which exports many useful functions. Simplest one is System.Cmd.system, which can run some application in shell, yielding exit code.

    More advanced features are provided too in the System.Process module. With this module you can run process and communicate with it in many ways (input piping, exit codes, waiting for process to stop, modify its environment etc).

提交回复
热议问题