BASIS  r3148
utilities.sh File Reference

Main module of project-independent BASIS utilities. More...

#include "${BASIS_UTILITIES_DIR}/core.sh"
+ Include dependency graph for utilities.sh:

Go to the source code of this file.

Functions

function execute (in options, in cmd, in args)
 Execute command as subprocess.
function exedir (out dir, in name)
 Get directory of executable file.
function exename (out file, in name)
 Get name of executable file.
function exepath (out path, in target)
 Get absolute path of executable file.
function istarget (in target)
 Determine whether a given build target is known.
function print_contact (in contact)
 Print contact information.
function print_version (in options, in name, in version)
 Print version information including copyright and license notices.
function qsplit (out var, in str)
 Split (quoted) string.
function targetuid (out uid, in name)
 Get UID of build target.
function tostring (out var, in elements)
 Build quoted string from array.

Variables

string CONTACT = "SBIA Group <sbia-software at uphs.upenn.edu>"
 Default contact to use for help output of executables.
string COPYRIGHT = "2011, 2012, 2013 University of Pennsylvania"
 Default copyright of executables.
string LICENSE = "See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file."
 Default license of executables.
string PROJECT = ""
 Project name.
string RELEASE = ""
 Project release.
string VERSION = ""
 Project version.

Detailed Description

Main module of project-independent BASIS utilities.

This module defines the default BASIS utility functions. These default implementations are not project-specific, i.e., do not make use of particular project attributes such as the name or version of the project. The utility functions defined by this module are intended for use in Bash scripts that are not build as part of a particular BASIS project. Otherwise, the project-specific implementations should be used instead, i.e., those defined by the basis.sh module of the project which is automatically added to the project during the configuration of the build tree. This basis.sh module and the submodules used by it are generated from template modules which are customized for the particular project that is being build.

Besides the utility functions which are common to all implementations for the different programming languages, does this module further provide fundamental functions for the development in Bash.

Note:
In Bash, there is no concept of namespaces. Hence, the utility functions are all defined by the utilities.sh module which is part of the BASIS installation. By simply setting the constants to the project specific values, these utility functions are customized for this particular package. This, however, also means that the BASIS utilities of two different packages cannot be used within a Bash script at the same time in general. The order in which the basis.sh modules are sourced matters. Therefore, in Bash, care must be taken which modules of a BASIS-based package are being sourced and whether these in turn source either the utilities.sh module of BASIS or the basis.sh module which has been configured/customized for this particular package. If all modules make only use of the utilities.sh module, there are no conflicts. Thus, Bash should in general only be used for executable scripts within a project, but not to provide library functions to other developers. Therefore, consider the use of C++, Python, or Perl, instead.

Copyright (c) 2011, 2012 University of Pennsylvania. All rights reserved.
See https://www.cbica.upenn.edu/sbia/software/license.html or COPYING file.

Contact: SBIA Group <sbia-software at uphs.upenn.edu>

Definition in file utilities.sh.