[Haskell-cafe] ANN: bash-0.0.0

Jason Dusek jason.dusek at gmail.com
Sun Mar 6 04:57:49 CET 2011


  Many-a-time, have I used higher level languages to generate
  Bash scripts. Here, for the first time, I have taken the time
  to write a structured and safe Bash pretty printer, leveraging
  some work on shell escaping I did some months ago.

    http://hackage.haskell.org/packages/archive/bash/0.0.0/doc/html/Language-Bash.html

  A wide range of Bash constructs are supported. It's easiest to
  point out what's not supported at present:

 .  Arithmetic substitutions (those within "$(( ))").

 .  Bash's test special form (using "[[ ]]"). Ordinary uses of
    the test command are of course fully supported.

 .  Specialized expression de-referencing forms that allow
    substitution and substring selection; the only thing
    supported in this domain is defaulting and length:

      ${#var}   # Length of var in bytes.
      ${var:-}  # If var is not set, yield the empty string.

  Many other forms that are tedious to get right -- special
  variable names, array expansions, even eval -- are fully
  supported.

  I'll be using this tool to support a config generation system.
  Another interesting application is generating Bash completion
  scripts.

  If you decide to use it and have trouble please let me know;
  this is the first Language.Something that I have written and
  it may not present the friendliest interface. Do let me know,
  also, if the omitted syntactic structures would be helpful to
  you and I will see what I can do to include them.

--
Jason Dusek
Linux User #510144 | http://counter.li.org/



More information about the Haskell-Cafe mailing list