Scroll to navigation

MORBIG(1) General Commands Manual MORBIG(1)

NAME

morbig - POSIX shell script parser

SYNOPSIS

morbig [ option ]... [ script-file ]...

DESCRIPTION

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.

OPTIONS

The following command-line options are recognized:

Skip input files which either are ELF executables, or which start with a magic string indicating a bash or perl script.
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:
binary format. This format can be read by applications using the morbig OCaml library. This is the default.
graphic representation in the dot format.
complete JSON output, including position information.
simplified JSON output. Use this for human-readable output.
do not serialise the concrete syntax tree.
Read names of input files from standard input.
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

Print at the end the total number of treated input files, the number of skipped input files, and the number of rejected input files.
Activate debugging information.
Show version number and exit.
Display usage information.

AUTHORS

morbig has been written for the project CoLiS by Yann Régis-Gianas, Nicolas Jeannerod and Ralf Treinen.