https://hal.archives-ouvertes.fr/hal-01897572
Raw File
Tip revision: ad0c16675d221938530269610308cd5a2c142687 authored by Software Heritage on 17 October 2018, 13:20:37 UTC
hal: Deposit 205 in collection hal
Tip revision: ad0c166
morbig.1
.TH MORBIG 1

.SH NAME
morbig \- POSIX shell script parser

.SH SYNOPSIS
.B morbig
[
.I option
]...
[
.I script-file
]...
.SH DESCRIPTION

The
.BR 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
.BR alias
and
.BR 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
.I \-\-continue-after-error
option.

.SH OPTIONS

The following command-line options are recognized:

.TP
.B \-\-skip-nosh
Skip input files which either are ELF executables, or which start with
a magic string indicating a bash or perl script.
.TP
.B \-\-as \fIformat\fR
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:
.RS 7
.TP
.I bin
binary format. This format can be read by applications using the
morbig OCaml library. This is the default.
.TP
.I dot
graphic representation in the dot format.
.TP
.I json
complete JSON output, including position information.
.TP
.I simple
simplified JSON output. Use this for human-readable output.
.RE
.TP
.B \-\-from-stdin
Read names of input files from standard input.
.TP
.B \-\-continue-after-error
If parsing of input \fIfile\fR fails, then write the error message in
file \fIfile\fR.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

.TP
.B \-\-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.
.TP
.B \-\-debug
Activate debugging information.
.TP
.B \-\-version
Show version number and exit.
.TP
.B \-\-help
Display usage information.
.SH AUTHORS
morbig has been written for the project CoLiS by
Yann RĂ©gis-Gianas, Nicolas Jeannerod and Ralf Treinen.
back to top