SHTK(1) BSD General Commands Manual SHTK(1)NAMEshtk — interface to the Shell Toolkit
SYNOPSISshtk build [-m main_function] [-o output_file] [-s shell] [input_file]
shtk version
DESCRIPTION
The Shell Toolkit, or shtk for short, is a collection of modules written
in sh(1) that provide common functionality to simplify the implementation
of complex shell scripts.
The tool described in this page, also named shtk, is a program that
accompanies the Shell Toolkit and provides functionality that may be nec‐
essary to use the toolkit.
The interface of shtk is that of a program with commands as shown in the
synopsis section. The following subsections describe the various com‐
mands supported by the tool.
The build command
The build command takes a script that uses shtk modules and generates an
executable script with the necessary boilerplate code to be able to
locate said modules.
The input_file argument specifies the path to the file to process. This
file should end with an ‘.sh’ extension, in which case the build command
will proceed to generate a binary of the same name without any extension.
If the extension is not present, then the name of the output file must be
provided by specifying the -o flag. The input file can also be ‘-’, in
which case the code is read from the standard input.
The following options are supported:
-m main_function
Name of the function that implements the entry point of the pro‐
gram.
All scripts that use shtk should implement a main function and
should avoid placing any code at the top level of the file. The
main function is automatically executed by the generated script.
If the value of main_function is empty, then no call to main is
issued which may be necessary if the script already has a call to
main for whatever reason (e.g. the script also uses atf-sh(1)).
Default: ‘main’.
-o output_file
Path to the output file to generate.
Default: if input_file ends in ‘.sh’, the output file has the same
name as the input file but without the extension. Otherwise this
flag must be specified.
-s shell
Path to the shell interpreter to write in the shebang line of the
file.
Default: /bin/sh.
The version command
The version command prints the name of the package and its version to the
standard output. This command always exits successfully.
ENVIRONMENT
SHTK_MODULESDIR
Overrides the built-in location of the modules.
SHTK_SHELL
Overrides the built-in location of the default shell interpreter.
FILES
/usr/pkg/share/shtk/
Location of the shtk modules.
SEE ALSO
Unfortunately, there currently is no standalone documentation of the
shtk. The documentation exists, but is in the form of docstrings next to
the functions they describe. Such docstrings document the purpose of the
function, the parameters it takes, its return value (if any) and any
side-effects.
Please look at the files in /usr/pkg/share/shtk for additional details.
AUTHORS
The shtk package was developed by Julio Merino ⟨jmmv@google.com⟩.
BSD August 15, 2012 BSD