SHTK(1)

NAME
shtk - Interface to the Shell Toolkit

SYNOPSIS
shtk 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 necessary to use the toolkit. For documentation on the API, please see shtk(3).

The interface of shtk is that of a program with commands as shown in the synopsis section. The following subsections describe the various commands 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 program. For programs using the shkt_unittest(3) module, this should be passed as -m shtk_unittest_main.

    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.

    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_MODULESPATH
    Colon-separated list of directories in which to look for modules. SHTK_MODULESDIR is always implied at the end of the path. The user can define this variable to point to other directories. This is especially handy in packages that install custom modules and want to use such modules before installing them.

SHTK_SHELL
    Overrides the built-in location of the default shell interpreter.

FILES

/usr/pkg/share/shtk/
    Location of the shtk modules.

SEE ALSO
shtk(3)

AUTHORS
The shtk package was developed by Julio Merino <jmmv@google.com>.