Home

scriptt.sh 2.x




Purpose

scriptt.sh is a template for Kornshell scripts.

scriptt.sh includes many predefined variables and functions (e.g. for string handling, user id handling, log file handling, house keeping routines, trap handler, etc). 

Detailed information about scriptt.sh including usage information are here: Detailed documentation for scriptt.sh.


If you're looking for a minimal script template with only the most useful functionality you might check out the template scriptt_mini.ksh

Note:


This is the documentation for version 2.x of scriptt.sh . This version is the current version.

The documentation for the version 1.x of scriptt.sh is here.



License


# CDDL HEADER START
#
# The contents of this file and the script are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License").  You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END


History


Version Releasedate Description
2.3.0.0 10.11.2017 ##V#   2.3.0.0 10.11.2017 /bs scriptt.sh
##V#     added the variable __RUNNING_IN_TERMINAL_SESSION
##V#     added the function print_runtime_variables
##V#     enhanced the function DebugShell
##V#     default user defined trap handler for CTRL-C is now DebugShell
##V#       edit the line
##V#         __SIGNAL_SIGINT_FUNCTION="DebugShell"
##V#       to change this behaviour
##V#       or use   ./scriptt.sh -D setvar:__SIGNAL_SIGINT_FUNCTION=""
##V#     if the script is called with redirected STDIN and without the parameter -q
##V#       all output for STDOUT and STDERR is now redirected to the file
##V#       /var/tmp/${0##*/}.STDOUT_STDERRR.$$
##V#     removed the variables SCRIPT_USER and SCRIPT_USER_MSG
##V#     added the variables __PROCS_TO_KILL and __PROCS_KILL_TIMEOUT to
##V#       define processes that should be stopped at script end
##V#     the debug switch "-D tracefunc" can now be used more then one time
##V#     the debug switches "-D tracefunc" and "-D debug" can be used at the same time
##V#     the debug switch "-D tracefunc" now supports the variable ${.sh.func} if running in ksh93
##V#     added the debug switch "-D DebugShell" to call the DebugShell while processing the parameter
##V#     fixed a typo: renamed __ingoretraps to __ignoretraps
##V#     the function f() to check the ksh version is now deleted after it is used
##V#     "typeset -f" replaced with "typeset +f" where applicable
##V#     the default value for the debug switch "-D cleanup" is now "all"
##V#     added the variable __TYPESET_F_SUPPORTED; this variable is set to "yes" if "typeset -f function"
##V#       can be used to print the statements of a function in the used shell
##V#     the debug switch "-D tracefunc" and the aliase for tracing in DebugShell now add the statements
##V#       typeset __FUNCTION=<function_name> ; ${__DEBUG_CODE};
##V#     to a function if neccessary, and "typeset -f" is supported by the shell used
##V#     the cleanup function now supports parameter for the exit routines
##V#     the cleanup function now supports parameter for the finish routines
##V#     added the variable __INSIDE_EXIT_ROUTINE
##V#     added the variable __INSIDE_FINISH_ROUTINE


Old History

Version
Releasedate
         Description
2.2.0.2 24.10.2016 ##V#   2.2.0.2 24.10.2016 /bs
##V#     SDTERR in DebugShell was not redirected to /dev/tty -- fixed
##V#     DebugShell returns now immediately if not running in an interactive session
2.2.0.1 17.01.2016 ##V#   2.2.0.1 17.01.2016 /bs
##V#     the content of the environment variable __DEBUG_CODE was not used -- fixed
##V#     adding -f to the rm and mv commands in BackupFileIfNecessary
##V#     __BACKUP_FILE was not always set to the correct value in BackupFileIfNecessary - fixed
##V#    now BackupFileIfNecessary returns ${__FALSE} if one or more backups failed
2.2.0.0
09.01.2016
##V#   2.2.0.0 09.01.2016 /bs
##V#     the function GetKeystroke did not process the parameter - fixed
##V#     GetKeystroke did not check for CTRL-C - fixed
##V#     the function GetKeystroke now supports the parameter [lower|upper] to convert the user input
##V#       to lowercase or uppercase; the real user input is still available in the global variable RAW_USER_INPUT
##V#     the script now prints the actions that would have been done in the cleanup routine if __NO_CLEANUP is set
##V#     added the parameter -D nocleanup (shortcut for -D setvar:__NO_CLEANUP=0)
##V#     added the parameter -D cleanup[=type] to enable/disable the house keeping
##V#     die() will now again end the script even if -f was used
##V#     includeScript now checks the syntax of an include script
##V#     added the function tryIncludeScript
##V#     added the parameter -D showdefaults
##V#     added the parameter -D tracemain
##V#     corrected some errors in the messages written by the script
##V#     reworked the comments in the script
##V#      added the variable __START_DIR_REAL
2.1.0.11 26.11.2015 ##V#   2.1.0.11 26.11.2015 /bs
##V#      moved initialisation of __SCRIPTNAME, __SCRIPTDIR, and
2.1.0.10 16.11.2015 ##V#   2.1.0.10 16.11.2015 /bs
##V#      replaced code incompatible with some ksh versions
2.1.0.9 26.10.2015 ##V#   2.1.0.9 26.10.2015 /bs
##V#     added the keyword printargs to the parameter -D
##V#     BackupFileIfNecessary now supports rotating backups, e.g.
##V#        file.0, file.1, file.3, ...
##V#     To use that feature the new format of the parameter for the
##V#     function is:
##V#
##V#        BackupFileIfNeccessary [file{,no_of_backups}] [...]
##V#
##V#     In the default configuration the script now creates a new log
##V#     file for each execution of the script and retains up to
##V#     10 backups of the log file.
##V#     To overwrite the number of backups use the following syntax for
##V#     the parameter -l:
##V#
##V#        -l logfile,[no_of_backups_of_the_logfile]
##V#
##V#     The default number of backups for the log file is configured in the variable
##V#     MAX_NO_OF_LOGFILES
2.1.0.8 09.09.2015 ##V#   2.1.0.8 09.09.2015 /bs
##V#      added the variable __SETOPTS and the alias __TRACE_ACTIVE
2.1.0.7
25.07.2015
##V#   2.1.0.7 25.07.2015 /bs
##V#      added the parameter -D dryrun. To use dryrun in your code
##V#        add the prefix "${PREFIX}" to every external command executed
##V#        by your script
##V#      added the parameter -D list_rc to list all return codes used in the script
##V#        (only works if you only use "die" to end the script)
2.1.0.6 08.07.2015 ##V#   2.1.0.6 08.07.2015 /bs
##V#     Added the parameter "-D debug"
2.1.0.5 08.05.2015 ##V#   2.1.0.5 08.05.2015 /bs
##V#      LogRuntimeInfo did not work in the default ksh from Solaris 11 --fixed
##V#
2.1.0.4 25.12.2014 ##V#   2.1.0.4 25.12.2014 /bs
##V#      __SCRIPTDIR was wrong if the script was called with the name only
2.1.0.3 12.12.2014 ##V#   2.1.0.3 12.12.2014 /bs
##V#     added the variable ${__BACKUP_FILE} to BackupFileIfNecessary
##V#
2.1.0.2 08.11.2014 ##V#   2.1.0.2 08.11.2014 /bs
##V#     corrected a bug in code for the parameter "-D fn_to_device=filename"
##V#     added ${__FUNCTION_EXIT} to some of the functions
##V#
2.1.0.2 06.11.2014 ##V#   2.1.0.2 06.11.2014 /bs
##V#     Added the parameter "-D create_dump=d"
##V#     the function rand now uses nawk in Solaris and awk in all other OS
2.1.0.1
04.11.2014
##V#   2.1.0.1 04.11.2014 /bs
##V#     Added the parameter variable__DEBUG_PREFIX
##V#     Added the function LogDebugMsg
##V#     Added the parameter "-D listfunc"
##V#     Added the parameter "-D fn_to_device=filename"
##V#     corrected a minor bug in the parameter handling for the parameter "-D"
2.1.0.0
02.11.2014
##V#   2.1.0.0 02.11.2014 /bs
##V#     Added the parameter -D SyntaxHelp to print syntax usage examples for the template
##V#     Added the parameter -D debugcode="x"
##V#     Added the parameter -D tracefunc=f1
##V#     Added the parameter -D setvar:name=value
##V#     Added the parameter -D create_documentation
##V#     Added more usage information for the template
2.0.0.7
27.04.2014
##V#   2.0.0.7 27.04.2014 /bs
##V#     AskUser now save the last input in the variable LAST_USER_INPUT, to enter
##V#       this value again use "#last"
##V#     Version parameter (-V) usage enhanced:  use "-v -v  -V" to print also the version
##V#       history; use "-v -v -v -V" to also print the template version history.
2.0.0.6
27.01.2014 ####   2.0.0.6 27.01.2014 /bs
####     added the function PrintLine
####     added the functions GetSeconds, GetMinutes, ConvertMinutesToHours,
####       and GetTimeStamp
####     added the debug options fn_to_stderr, fn_to_tty, and fn_to_handle9
####     max. return value for a function is 255 and therefor the functions
####       for the stack and the functions pos and lastpos now abort the
####       script if a value greater than 255 should be returned
####     added the variables __SHEBANG, __SCRIPT_SHELL, and __SCRIPT_SHELL_OPTIONS
####     added the function DebugShell
####     AskUser now has a hidden shell; use "shell<return>" to call the DebugShell
####       set __DEBUG_SHELL_IN_ASKUSER to ${__FALSE} to disable the DebugShell
####       in AskUser
####     added the function ConvertDateToEpoc
2.0.0.5 08.01.2014 ####   2.0.0.5 08.01.2014 /bs
####      added the function executeFunctionIfDefined
2.0.0.4 01.01.2014 ####  2.0.0.4 01.01.2014 /bs
####     the alias __settrap is renamed to settraps (with leading s)
####     two new aliase are defined: __ingoretraps and __unsettraps
####     whence function for non-ksh compatible shells rewritten
####       without using ksh
####     the switch -D is now used to toggle debug switches
####       known debug switches:
####        help  -- print the usage help for -D
####         msg  -- log debug messages to /tmp/<scriptname>.<pid>.debug
####       trace  -- activate tracing to the file /tmp/<scriptname>.<pid>.trace
####     AskUser now accepts also "yes" and "no"
####     function IsFunctionDefined rewritten
####     now __LOGON_USERID and __USERID are equal to $LOGNAME until I
####     find a working solution
####       (the code in the previous version did not work if STDIN is not a tty)
2.0.0.3 16.12.2013 ####  2.0.0.3 16.12.2013 /bs
####     now the Log-* functions return ${__TRUE} if a message is printed
####     and ${__FALSE} if not
2.0.0.2 01.09.2013 ####  2.0.0.2 01.09.2013 /bs
####     added the variables __SYSCMDS and __SYSCMDS_FILE
2.0.0.1 06.08.2013 ####  2.0.0.1 06.08.2013 /bs
####     added the variable __MACHINE_SUB_CLASS. Possible values
####     for sun4v machines: either "GuestLDom" or "PrimaryLDom"
2.0.0.0
31.05.2013
####  2.0.0.0 17.05.2013 /bs
####     added the variable __GENERAL_SIGNAL_FUNCTION: This variable
####     contains the name of a function that is called for all SIGNALs
####       before the special SIGNAL handler  is called
####     removed the Debug Handler for single step execution (due to the
####       length of the  template it is not useful anymore; use the
####       version 1.x of scriptt.sh if you still need the Debug Handler)
####     function executeCommandAndLogSTDERR rewritten
####     removed the function CheckParameterCount
####     use lsb_release in Linux to retrieve OS infos if available
####     minor fixes for code and comments
####    replaced PrintWithTimeStamp with code that does not use awk


... (see here for the old history entries)
1.20.0
08/01/2005
some enhancements and bug fixes
1.18.2
03/18/2005 minor bug fixes
1.18.0
02/02/2005


Operating system

Solaris, Linux, AIX, Windows with Cygwin


Language / type

Kornshell Script developed for ksh88; should also run under ksh93 or bash.


Prerequisites

a ksh binary


Script Usage

Predefined parameter:


[xtrnaw7@t540p /data/develop/scripts]$ ./scriptt.sh -v -v -h
[11.11.2017 12:01:07] scriptt.sh v1.0.0 started at Sat Nov 11 12:01:07 CET 2017.
[11.11.2017 12:01:07] Reading the config file "/data/develop/scripts/scriptt.conf" ...
[11.11.2017 12:01:07] RUNTIME INFO: Parameter after processing the default parameter are:  "-v -v -h" 
  scriptt.sh v1.0.0 - ??? short description ???

  Usage: scriptt.sh [-v|+v] [-q|+q] [-h] [-l logfile|+l] [-y|+y] [-n|+n]
                    [-D debugswitch] [-a|+a] [-O|+O] [-f|+f] [-C] [-H] [-X] [-S n] [-V] [-T]

                    [??? add additional parameter here ???]


  Use the parameter "-v -h [-v]" to view the detailed online help; use the parameter "-X" to view some usage examples.

  see also http://bnsmb.de/solaris/scriptt.html




 Note: Use -{switch} or --{longswitch} to turn an option on;
       use +{switch} or ++{longswitch} to turn an option off

       The long format of the parameter (--parameter/++parameter) is not supported by all ksh implementations


    Parameter:

      -v|+v - turn verbose mode on/off; current value: y
              Long format: --verbose / ++verbose
      -q|+q - turn quiet mode on/off; current value: n
              Long format: --quiet / ++quiet
      -h    - show usage
              Long format: --help
      -l    - set the logfile
              current value: /var/tmp/scriptt.log
              use "-l [logfile,no_of_backups]" to define the number of retained backups
              of the logfile; the default no of backups is 10
              Long format: --logfile
      +l    - do not write a logfile
              Long format: ++logfile
      -y|+y - assume yes to all questions or not
              Long format: --yes / ++yes
      -n|+n - assume no to all questions or not
              Long format: --no /++no
      -D    - debug switch
              current value:
              use "-D help" to list the known debug switches
              Long format: --debug / ++debug
      -a|+a - turn colors on/off; current value: n
              Long format: --color / ++color
      -O|+O - overwrite existing files or not; current value: n
              Long format: --overwrite / ++overwrite
      -f|+f - force; do it anyway; current value: n
              Long format: --force / ++force
      -C    - write a default config file in the current directory and exit
              Long format: --writeconfigfile
      -H    - write extended usage to STDERR and exit
              Long format: --doc
      -X    - write usage examples to STDERR and exit
              Long format: --view_examples
      -S n  - print error/warning summaries:
              n = 0 no summariess, 1 = print error msgs,
              2 = print warning msgs, 3 = print error and warning mgs
              Current value: 0
              Long format: --summaries
      -V    - write version number to STDOUT and exit
              Long format: --version
              use "-v -V" to print also the template version
              use "-v -v -V" to print also the version history
              use "-v -v -v -V" to also print the template version history
      -T    - append STDOUT and STDERR to the file "/var/tmp/scriptt.sh.1581.tee.log"
              Long format: --tee

      [??? add additional parameter here ???]



  Use  "-D create_documentation" to create all available documentation for the script.

  Use "-D SyntaxHelp" to print usage examples for the functions defined in the
  template to STDERR.

  Environment variables that are used if set before calling this script (0 = TRUE, 1 = FALSE):

  __DEBUG_CODE (Current value: "")
  __RT_VERBOSE_LEVEL (Current value: "1")
  __QUIET_MODE (Current value: "1")
  __VERBOSE_MODE (Current value: "0")
  __VERBOSE_LEVEL (Current value: "2")
  __OVERWRITE_MODE (Current value: "1")
  __USER_BREAK_ALLOWED (Current value: "0")
  __NO_TIME_STAMPS (Current value: "1")
  __NO_HEADERS (Current value: "1")
  __USE_COLORS (Current value: "1")
  __USE_RBAC (Current value: "1")
  __RBAC_BINARY (Current value: "/usr/bin/pfexec")
  __TEE_OUTPUT_FILE (Current value: "/var/tmp/scriptt.sh.1581.tee.log")
  __INFO_PREFIX (Current value: "INFO:")
  __DEBUG_PREFIX (Current value: "DEBUG:")
  __WARNING_PREFIX (Current value: "WARNING:")
  __ERROR_PREFIX (Current value: "ERROR:")
  __RUNTIME_INFO_PREFIX (Current value: "RUNTIME INFO:")
  __NO_CLEANUP (Current value: "1")
  __NO_KILL_PROCS (Current value: "1")
  __PROCS_KILL_TIMEOUT (Current value: "0")
  __NO_EXIT_ROUTINES (Current value: "1")
  __NO_TEMPFILES_DELETE (Current value: "1")
  __NO_TEMPMOUNTS_UMOUNT (Current value: "1")
  __NO_TEMPDIR_DELETE (Current value: "1")
  __NO_FINISH_ROUTINES (Current value: "1")
  __CLEANUP_ON_ERROR (Current value: "1")
  __CREATE_DUMP (Current value: "")
  __DUMP_ALREADY_CREATED (Current value: "")
  __DUMPDIR (Current value: "")
  __USE_ONLY_KSH88_FEATURES (Current value: "1")
  CONFIG_FILE (Current value: "")
[11.11.2017 12:01:07] The log file used was "/tmp/scriptt.sh.1581.TEMP" 
[11.11.2017 12:01:07] scriptt.sh v1.0.0 started at Sat Nov 11 12:01:07 CET 2017 and ended at Sat Nov 11 12:01:07 CET 2017.
[11.11.2017 12:01:07] The time used for the script is 0 minutes and 0 seconds.
[11.11.2017 12:01:07] The RC is 1.
[xtrnaw7@t540p /data/develop/scripts]$

 


Known debug switches for scriptt.sh


[xtrnaw7@t540p /data/develop/scripts]$ ./scriptt.sh -D help
[11.11.2017 12:02:29] scriptt.sh v1.0.0 started at Sat Nov 11 12:02:29 CET 2017.
[11.11.2017 12:02:29] Reading the config file "/data/develop/scripts/scriptt.conf" ...
Known debug switches (for -D / --debug):

  help          -- show this usage and exit
  create_documentation
                -- create the script documentation
  list_rc       -- list return codes used by this script
                   Works only if you only use "die" to end the script
  msg           -- log debug messages to the file /tmp/scriptt.sh.1712.debug
                   This parameter should be the first parameter.
  trace         -- activate tracing to the file /tmp/scriptt.sh.1712.trace
  tracemain     -- trace the main function
  fn_to_stderr  -- print the function names to STDERR
  fn_to_tty     -- print the function names to /dev/tty
  fn_to_handle9 -- print the function names to the file handle 9
  fn_to_device=filename
                -- print the function names to the file "filename"
  debugcode="x" -- execute the debug code "x" at every function start
                   CAUTION: The debug code should NOT write to
                            STDOUT - use STDERR instead
  printargs     -- print the script arguments
  tracefunc=f1[,...,f#]
                -- enable tracing for the functions f1 to f#
  debug[=cmd]   -- exeucte the command "cmd" or call a very simple cmd loop
  DebugShell    -- start the DebugShell
  setvar:name=value
                -- set the variable "name" to "value"
  listfunc      -- list all functions defined and exit
  showdefaults  -- show the default variable values
  create_dump=dirname
                -- enable environment dumps; target directory is dirname
  SyntaxHelp    -- print syntax usage examples for the functions in the template
                   and exit
  dryrun        -- dry run only, do not execute commands
  dryrun=prefix -- dry run only, add the prefix "prefix" to all commands

  nocleanup     -- disable the house keeping at script end
  cleanup[=type]
                -- disable or enable the house keeping at script end; "type" can be
                     all - enable all house keeping (this is the default)
                     none - disable all house keeping
                     nodelete - disable only removing of temporary files and directories

[11.11.2017 12:02:29] The log file used was "/tmp/scriptt.sh.1712.TEMP" 
[11.11.2017 12:02:29] The debug messages are logged to "/tmp/scriptt.sh.1712.debug" 
[11.11.2017 12:02:29] scriptt.sh v1.0.0 started at Sat Nov 11 12:02:29 CET 2017 and ended at Sat Nov 11 12:02:29 CET 2017.
[11.11.2017 12:02:29] The time used for the script is 0 minutes and 0 seconds.
[11.11.2017 12:02:29] The RC is 0.
[xtrnaw7@t540p /data/develop/scripts]$


DebugShell


The function DebugShell can be used to debug a running script; just call the function DebugShell in your code at any time.

In the default configuration DebugShell is also called if CTRL-C is pressed.

In principle DebugShell is only a loop that reads input from the user and executes it. DebugShell know some aliase and interprets everything else as an OS command.
DebugShell only works if the script is called in an interactive terminal session; all output is written to /dev/tty and all input is only read from /dev/tty.

DebugShell online help


[14.10.2017 17:23:04] Using the log file "/var/tmp/scriptt.log" 
Press return to continue ...
*** Debug Shell called via CTRL-C ***

 -------------------------------------------------------------------------------
scriptt.sh - debug shell (called via CTRL-C) - enter a command to execute ("exit" to leave the shell)
  defined aliasse: functions = list all defined functions, vars [help|var_list] = print global variables,
                   quit = exit the script, abort = abort the script with kill -9, use help for short usage help
                   cont = continue script execution
>> help

Enter either an defined alias or an OS command to execute

Defined aliasse are:

functions                     - print all defined functions
func f1 [...f#]               - view the source code for the functions f1 to f#
                                (supported by this shell: yes)

add_debug_code f1 [...f#]     - add debug code to the functions f1 to f#; use all for f1 to add
                                debug code to all functions
                                (supported by this shell: yes)
                     
view_debug                    - view the current debug code
set_debug f1 [...f#]          - enable tracing for the functions f1 to f#
                                Note: The existing trace definitions will be overwritten!
clear_debug                   - disable tracing for all functions

vars help                     - print defined variable lists
vars var_list                 - print the variable from the variable list 'var_list'
vars all                      - print all variables

verbose                       - toggle the verbose switch (current value is: 1, __VERBOSE_LEVEL is 0)
break                         - toggle the break switch (current value is: 0)

exit                          - exit the shell
quit                          - exit the script
abort                         - exit the script with 'kill -9'

cont                          - continue the script execution

Everthing else is interpreted as an OS command


 -------------------------------------------------------------------------------
scriptt.sh - debug shell (called via CTRL-C) - enter a command to execute ("exit" to leave the shell)
  defined aliasse: functions = list all defined functions, vars [help|var_list] = print global variables,
                   quit = exit the script, abort = abort the script with kill -9, use help for short usage help
                   cont = continue script execution

>> vars help

Known variable lists are:

      all               - print all variables used

      application       - print application variables
      used_env          - print environment variables used
      log               - print variables for the logfile handling
      defaults          - print variables with DEFAULT_* values
      config            - print variables for the config file processing
      house_keeping     - print variables for the housekeeping processing
      signalhandler     - print variables for the signal handler
      dump              - print variables for the dump processing
      script            - print variables with the script name, directory, etc
      debug             - print variables for the debug functions
      parameter         - print variables for the parameter
      requirements      - print variables for the script requirements
      runtime           - print various runtime variables
      os_env            - print variables for the OS environment
      internal          - print all internal variables execept these variables
                            __LONG_USAGE_HELP __SHORT_USAGE_HELP
                            __OTHER_USAGE_EXAMPLES __CONFIG_PARAMETER


 -------------------------------------------------------------------------------
scriptt.sh - debug shell (called via CTRL-C) - enter a command to execute ("exit" to leave the shell)
  defined aliasse: functions = list all defined functions, vars [help|var_list] = print global variables,
                   quit = exit the script, abort = abort the script with kill -9, use help for short usage help
                   cont = continue script execution
>>





Documentation


Use the parameter - D create_documentation to create the documentation for scriptt.sh:

[xtrnaw7@t540p templates]$ ./scriptt.sh -D create_documentation
[01.11.2014 18:39:01] scriptt.sh v1.0.0 started at Sa 1. Nov 18:39:01 CET 2014.
[01.11.2014 18:39:01] No config file ("scriptt.conf") found (use -C to create a default config file)
[01.11.2014 18:39:01] Writing the long usage documentation to scriptt.sh.long_usage.txt ...
[01.11.2014 18:39:01] Writing the debug switch documentation to scriptt.sh.debug_switches.text ...
[01.11.2014 18:39:01] Writing the script documentation to scriptt.sh.txt ...
[01.11.2014 18:39:01] Writing the script usage examples to scriptt.sh.usage_examples.txt ...
[01.11.2014 18:39:01] Writing the function usage examples to scriptt.sh.function_examples.txt ...
[01.11.2014 18:39:01] Using the log file "/var/tmp/scriptt.LOG" 
[01.11.2014 18:39:01] The log file used was "/var/tmp/scriptt.LOG" 
[01.11.2014 18:39:01] scriptt.sh v1.0.0 started at Sa 1. Nov 18:39:01 CET 2014 and ended at Sa 1. Nov 18:39:01 CET 2014.
[01.11.2014 18:39:01] The time used for the script is 0 minutes and 0 seconds.
[01.11.2014 18:39:01] The RC is 0.
[xtrnaw7@t540p templates]$




Scriptt test suite


Beginning with version 1.22.38 there is now also a test suite for scriptt.sh: scriptt_testsuite.sh

Using this test suite you can test if scriptt.sh is properly running on other Operating systems and/or other shells.

The test suite tests

To use the test suite uncomment or add the following lines to scriptt.sh:

  set --
  .  ./scriptt_testsuite.sh


(scriptt_testsuite.sh must be in the current directory to make this work)

An example output of scriptt_testsuite for ksh in Solaris is here:

scriptt_testsuite output



Notes

You must add your own code to scriptt.sh - without it, it is not very useful.


Links


http://www.shelldorado.com/
Heiner's Shell Dorado
http://apenwarr.ca/log/?m=201102#28
Insufficiently known POSIX shell features
http://blog.fpmurphy.com/2008/10/ksh93-date-manipulation.html
ksh93 builtin time formatting with printf examples
http://www.unix.com/unix-dummies-questions-answers/13018-exit-status-command-pipe-line.html#post47559
source for the function executeCommandAndLog



Download

Download scriptt.sh


Documentation

scriptt.sh usage help

scriptt.sh debug switches documentation

scriptt.sh function documentation

scriptt.sh function examples

Testsuite

Download scriptt_testsuite.sh

Download script_test.sh




Back to top