Using Haskell's Turtle to Call a Custom Bash Function

176 Views Asked by At

Using turtle, how does one run a custom bash command found in /a/path/to/a/file.sh? It would be the equivalent of source /a/path/to/a/file.sh and then calling custom_bash_function.

1

There are 1 best solutions below

1
On
{-# LANGUAGE OverloadedStrings #-}

import Turtle.Prelude (proc, procs, shell, shells)

main :: IO ()
main = do
  procs "ls" [] mempty         --(without ExitCode)
  procs "ls" ["-la"] mempty    --(without ExitCode)
  proc "pwd" [] mempty         --(with ExitCode)
  proc "ls" ["-la"] mempty     --(with ExitCode)

  shells "ls -la" mempty       --(without ExitCode)
  shell "pwd" mempty           --(with ExitCode)
  shell "ls -la" mempty        --(with ExitCode)