ihatetoregister ihatetoregister - 1 year ago 114
Bash Question

Can Haskell be used to write shell scripts?

Is it possible to write shell scripts in Haskell and if so, how do you do it? Just changing the interpreter like so?


Answer Source

Using ghci will just load the module in GHCi. To run it as a script, use runhaskell or runghc:

#!/usr/bin/env runhaskell
main = putStrLn "Hello World!"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download