morbig [ option ]... [ script-file ]...
The morbig(1) command is a parser for shell scripts written
in the POSIX shell script language. It parses the scripts statically, that
is without executing them, and constructs a concrete syntax tree for each of
them. The concrete syntax trees are built using constructors according to
the shell grammar of the POSIX standard.
As required by the POSIX standard, morbig does alias expansion
prior to syntactic analysis. The alias and unalias commands
are executed by morbig, allowing for multiple arguments, but only when these
commands occur at toplevel, that is not inside a compound control structure
like a conditional construct or a loop construct. morbig raises an error if
an alias or unalias command occurs inside a compound construct since these
cannot be handled statically.
The parser processes input files in order, and stops at the first
error encountered. This behavior may be changed by using the
--continue-after-error option.
The following command-line options are recognized:
- --skip-nosh
- Skip input files which either are ELF executables, or which start with a
magic string indicating a bash or perl script.
- --as format
- Write for each input file that has been successfully parsed a file
containing the concrete syntax tree of the script. The format may be one
of the following:
- bin
- binary format. This format can be read by applications using the morbig
OCaml library. This is the default.
- dot
- graphic representation in the dot format.
- json
- complete JSON output, including position information.
- simple
- simplified JSON output. Use this for human-readable output.
- none
- do not serialise the concrete syntax tree.
- --from-stdin
- Read names of input files from standard input.
- --continue-after-error
- If parsing of input file fails, then write the error message in
file file.morbigerror instead of stderr, and continue with the next
input file. This may be used to parse a large number of scripts without
creating a new UNIX process for each of them, like this:
find . -name "*.sh" | morbig --continue-after-error
--from-stdin
- --display-stats
- Print at the end the total number of treated input files, the number of
skipped input files, and the number of rejected input files.
- --debug
- Activate debugging information.
- --version
- Show version number and exit.
- --help
- Display usage information.
morbig has been written for the project CoLiS by Yann
Régis-Gianas, Nicolas Jeannerod and Ralf Treinen.