HsShellScript Features

Command Line Argument Parser

HsShellScript has facilities for managing command line arguments, which are easier to use than the GHC library GetOpt. Command line arguments are specified as lists of properties. HsShellScript builds on top of GHC's GetOpt, but hides it completely. Command line arguments handling has been added because GetOpt was found to be too cumbersome.

Easy Interface to External Programs

Calling programs and recognizing errors (via exitcode or exception) is made more easy. There are front end functions for common programs, such as /bin/mv or /bin/chmod.

Analyzing Paths

Dealing with paths is not as trivial as it sounds. Take, for example ../foo.bar//./../baz/ (and split off the extension of the file name...). HsShellScript solves this thoroughly and provides functions for such tasks as splitting a path in directory and file name parts, splitting a path into path components, or syntactically normalising paths.

Redirecting Input and Output

HsShellScript defines operators like ->- and ->>- which work like redirection operators in shells.

Building Pipes

Reading the output of an external program, or piping the output of one program into the input of another, is almost as easy as in shells. HsShellScript provides corresponding operators.

Error Handling

Error handling is one thing which is done more thoroughly in HsShellScript than in shells. Failed programs won't be silently ignored. Exceptions are used for error handling. Non zero exit codes are thrown as exceptions.

Quoting of Strings and Building Commands for Shells

Taking care of shell metacharacters usually isn't done right. HsShellScript provides functions for doing it safely.

Non-broken, Secure Functions for Creating Temporary Files and Directories

The standard C library has mkstemp, mktemp, tempnam, tmpfile and tmpnam, which are all broken, non-portable or unsuitable in some way.

HsShellScript User Manual main page