tmpd

tmpd

part of shnell – a source to source compiler enhancement tool

© Jens Gustedt, 2017

Temporary files and garbage collection

If not otherwise specified temporary files are created in a specific directory below /tmp

If this module is used by recursive scripts, the temporary directories for them will be nested according to the call dependency.

Coding and configuration

The following code is needed to enable the sh-module framework.

SRC="$_" . "${0%%/${0##*/}}/import.sh"

Imports

The following sh-modules are imported:

Details

Declared functions

cleanup: Program exit

This function is called at the end of execution to clean up temporary files. It is installed on all exits that we might be able to capture.

killup: Signal handling This function is called in addition, if a signal has been caught. It prints the number of the signal and then runs cleanup.

newTmp: Get a new temporary file name.

Call this as

``cppnewTmp VARIABLE [EXTENSION]`

where EXTENSION is set to c if omitted. After the call, variable VARIABLE will be set to the result. ### newNumber: Get a new number that is unique for the same jobid Call this as

newNumber VARIABLE

After the call, variable VARIABLE will be set to the result. All places that use the same name VARIABLE will receive a different value during processing for the same job, even if they end up being in different sub-processes.