Skip to content

Latest commit

 

History

History
49 lines (42 loc) · 1.65 KB

README.md

File metadata and controls

49 lines (42 loc) · 1.65 KB

bash-config

This package allows Bash configuration files to be parsed and interpreted from Haskell, without executing any commands. Many shell scripts use these as configuration files, which are intended to be sourced for shell variable assignments.

This library fully parses Bash scripts, but can only interpret a limited subset of Bash. No commands are actually executed. Since this in theory could limit the ability to interpret a configuration file, the interpreter only returns variables it is sure are correct; all other variables are unknown. In practice, however, configuration scripts are simple enough and pure enough for the library to interpret completely.

Features

Implemented features are executed faithfully. Unimplemented features are executed in a safe manner, removing variables that could change. Unsafe features cause the interpreter to fail.

Implemented

  • Parameter assignment and compound assignment
  • Arrays
  • Most parameter expansions
  • Brace expansions
  • Groups, subshells, pipelines, &&, and ||
  • Conditional commands ([[ .. ]], test, and [ .. ])
  • true and false
  • if statements
  • Function definitions
  • Function execution

Partially implemented

  • Assignment builtins alias, declare, export, local, readonly, and typeset. Implementations are currently unsafe.

Unimplemented

  • Special and positional parameters
  • External commands
  • Redirections
  • Builtins cd, pwd, eval, break, continue, etc.
  • Tilde expansion
  • Filename expansion
  • Command, process, and arithmetic substitution
  • Arithmetic commands
  • Looping constructs
  • Case commands

Unsafe

  • Builtins exit, return, source, ., etc.