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.
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.
- Parameter assignment and compound assignment
- Arrays
- Most parameter expansions
- Brace expansions
- Groups, subshells, pipelines,
&&
, and||
- Conditional commands (
[[ .. ]]
,test
, and[ .. ]
) true
andfalse
if
statements- Function definitions
- Function execution
- Assignment builtins
alias
,declare
,export
,local
,readonly
, andtypeset
. Implementations are currently unsafe.
- 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
- Builtins
exit
,return
,source
,.
, etc.