NAME

     new - generate a shell template


SYNOPSIS

         new - (takes all defaults)
     or
         new --usage | -u
     or
         new [ options ]


DESCRIPTION

     The new program is a shell script generator, i.e. it's  out-
     put is a template for writing a shell program.

     Typically, when a shell program is to be written, there  are
     various programming steps that all shells must do, such as:
         1) creating a variable with the name of the shell
            script, typically using basename  or  an  appropriate
            shell  variable  syntax  to  extract  the name of the
            shell script from $0, which is then  used in I/O.
         2) creating temporary files
         3) removing temporary files
         4) parsing the command line options
         5) setting a trap for user interrupts
         6) exiting with an appropriate exit value

     The type of template shell output by new  is  controlled  by
     command line options.  See OPTIONS, below.

     The new shell does the following:

         Creates the variable NAME and binds it with the name you
         give to the template shell you are creating.

         Tests the environment variable ECHO and turns on  debug-
         ging  of  the template shell depending upon the value of
         ECHO.

         Creates a USAGE  variable  for  I/O  from  the  template
         shell.

         Creates a set of  uniquely  named  temporary  files  and
         removes  them  when  the template shell exits, via func-
         tions created internally to the template shell.

         Creates the template shell code needed to clean up  tem-
         porary  files  under common circumstances, i.e. when the
         template shell receives an  interrupt  (SIGINT),  hangup
         (SIGHUP)  or  terminate  (SIGTERM) signal.  These can be
         easily extended.

         Tests for zero command line arguments  supplied  to  the
         template shell and, if there are zero command line argu-
         ments, the template shell echo's out the usage  variable
         and exits.

         Generates code so that the template  shell  will  accept
         the  singleton   "-" option or the singleton "--" option
         to override usage, thereby allowing  the  programmer  of
         the  template shell to have options that enable the user
         of the template shell to to "take all defaults" (of  the
         template shell).

         Prompts for options that the template shell  program  is
         going  to accept.  These can be redirected from standard
         input and, if so, then new will suppress unnessary I/O.

         Options collected from the  above  prompting  are  coded
         into  the template shell so that the template shell will
         accept the options in one of three ways:
           o) GNU style long options as well as one character
              options
           o) OR using the standardized UNIX getopts parsing
              method for one character options
           o) OR omits both GNU and getopts styles so the
              template shell programmer can write her/his own

         Creates a template shell variable for each option to  be
         accepted  by  the  template shell (like the PERL Getopts
         function).

         Optionally includes code to demonstrate the use  of  the
         workctl and working shell scripts included with this set
         of software.  The workctl and working shell  allows  the
         template shell to output fancy
              working...+ continuing
         strings where the "+" is actually a spinning dial.


OPTIONS

     The following options are supported:

     --version or -v
          Prints the product version number and exits.

     --usage or -u
          Prints the usage information and exits.


     --getopts or -G
          Interactive prompting for  options  that  the  template
          shell  is to acceopt will occur. There will be a prompt
          for a short style option, e.g.: --o= or --o.

     --nogetopts or -N
          Disables the --getopts option.


     --gnustyle or -g
          Interactive prompting for  options  that  the  template
          shell  is to acceopt will occur. There will be a prompt
          for a long style option, e.g.:  --option=  or  --option
          and  a  prompt to confirm (or change) the short version
          which would default to -o, in this example.

     --nognustyle or -n
          Disables the --gnustyle option.

     --omit or -o
          Same as --nognustyle and --nogetopts.  In this case  no
          options are prompted for.

     --threevariants or -3

     --twovariants or -2
          These options toggle each other.  They are used to con-
          trol  how  the --gnustyle option handles the 3 possible
          variations  of  accepting  command  line  options  that
          require a parameter.  The three variants are:
               --option=parameter
               --oparameter        <-- no space
               --o parameter       <-- whitespace
          If the third variant,
               --o parameter       <-- whitespace
          is to  be  accepted  the  then  --threevariants  option
          should   be  taken,  otherwise  use  the  --twovariants
          option.

     --negate or -e
          Provided options will be prompted for (i.e.  --omit  is
          NOT  in  effect), then the template that is output will
          contain a --no<option> to negate  taking  the  prompted
          for option.

     --nonegate or -E
          Disabled th --negate option.

     --plugin or -p
          The template shell will contain the three SMDP_*  vari-
          ables:
               SMDP_COLOR="green";
               SMDP_FORMAT="text";
               SMDP_LABEL="${NAME}";
          for use with SMDP plugins.  The code above will, natur-
          ally,  be  in  the  shell language selected.  The above
          three variables will have the default values shown  and
          they  will  be  output  as  the last three lines of the
          shell.  See:
          http://www.opensysmon.com/support/developer.html
          for more information about SMDP and SMDP plugins.

     --noplugin or -i
          Disables --plugin (where -i denote ignore plugin  vari-
          ables).

     --work or -w
          The shell template that is output will contain  workctl
          calls that output fancy I/O.  For example:
               working+ ... continue
          is output where the "+" character is actually  a  spin-
          ning dial.  It spins while the shell is busy working.

     --nowork or -W
          Disables --work.

     --date or -d
          Include a
              # generated on: `date`
          comment in the template that is output.

     --nodate or -D
          Disables --date.

     --bourne or -B

     --sh or -s
          The output template  shell  will  be  a  "sh"  (Bourne)
          shell.  The --sh/-s are aliases for --bourne/-B.

     --korn or -k
          The output template shell will be a "ksh" (Korn) shell.

     --bash or -b
          The output template shell will be a "bash" (Born  Again
          Shell) shell.

     --csh or -c
          The output template shell will  be  a  "csh"  (C-shell)
          shell.

     --tcsh or -t
          The output template shell will be a "tcsh"  (TC  shell)
          shell.

     --output=file or -ofile
          The generated template is written to file.  By  default
          the template is sent to standard output.  By specifing:
                  --output=-
          the template will be sent to standard  output,  and  by
          specifing:
                  --output=--
          the template will be sent to standard error.  Otherwise
          the file specified will be written.


EXAMPLES

         new --gnustyle --threevariants  --work     --plugin   --bourne  --output=template.sh


ENVIRONMENT

     The environment variable ECHO is  examined  by  the  program
     new.   If  enabled  (true/yes/on)  the  program new turns on
     echoing of commands.  This  is  done  by  having  the  shell
     script  issue a set -x command.  If the ECHO variable is set
     to the value DEBUG then some internal debugging  is  enabled
     that  shows  when  various  functions are entered/exited and
     some other debugging features.   When  ECHO=DEBUG  is  used,
     then it is also a good idea to use the
         --output=--
     command line option so that the template output by  new,  is
     correctly interleaved with the debugging output (i.e. inter-
     leaved as it occures).  Also, it is  generally  useful  when
     debugging  to  redirect  standard input from a file that has
     all the options you want so you not be  prompted  for  them,
     e.g.:
         new [options] < i
     Where the file i might contain these lines
             --prefix=
             no
             -P

             --check=

             --help

             --usage




EXIT STATUS

     Normally this shell script program  exits  zero(0).   If  an
     error  occurs,  the  shell script program exits one(1) or it
     will exit the exit status of the UNIX program that failed.


FILES

     none


SEE ALSO

     For website information about the plugins and to access  the
     shell archive:
         http://www.opensysmon.com
         ftp://ftp.opensysmon.com

     new(1), working(1), workctl(1).

     Any of the supported shell languages:
     sh(1), ksh(1), bash(1), csh(1), tcsh(1).


NOTES

     The three shell script programs, new, working,  and  workctl
     should  be consistent with regard to any edits that might be
     made to the configuration  section.   For  example,  if  you
     change the value of SIGUSR1 in one script but not the others
     then the shells will behave in strange ways.










































Man(1) output converted with man2html