shtk_cleanup_register man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

SHTK_CLEANUP_REGISTER(3) BSD Library Functions Manual SHTK_CLEANUP_REGISTER(3)

NAME
     shtk_cleanup_register — Installs cleanup handlers to be called on script
     termination

LIBRARY
     shtk_import cleanup

SYNOPSIS
     shtk_cleanup_register handler1 [.. handlerN]

DESCRIPTION
     The shtk_cleanup_register function installs one or more cleanup handlers,
     given in the handler1 to handlerN arguments as function names.

     The registered handlers are executed in the order they are originally
     registered.  Registration of handlers is idempotent.

EXAMPLES
     The following example creates a temporary file and installs a cleanup
     handler to ensure that the file gets removed when the script terminates:

	   local pattern="${TMPDIR:-/tmp}/my_program.XXXXXX"

	   local temp_file="$(mktemp "${pattern}" 2>/dev/null)"
	   [ -f "${temp_file}" ] || shtk_cli_error "Failed to create temporary file"

	   eval "remove_temp_file() { rm -f '${temp_file}'; }"
	   shtk_cleanup_register remove_temp_file

SEE ALSO
     shtk(3), shtk_cleanup(3)

HISTORY
     shtk_cleanup_register first appeared in shtk 1.4.

BSD			       November 5, 2014				   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net