print_header

Package: WA2L/edrc 1.5.57
Section: Library Commands (3)
Updated: 09 November 2023
Index Return to Main Contents

 

NAME

print_header - print a standard report header

 

SYNOPSIS

edrc/lib/print_header [ -h ]

print_header [ "report title" [ indent [ add_hostname ]]]

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

print a standard report header to the terminal. The report header consists of the report title, the customer, the environment and the date of the report creation.

The customer and the environment part are resolved by server_environment(3) internally.

The output is limited to the current terminal width if the environment variable $PRINT_FIT2WIDTH is not set to False.

 

OPTIONS

-h
usage message.

"report title"
title of the report. The specified text is converted to upper case.

indent
left indent of the output in characters. If not specified the output is not indented.

add_hostname
set to True to add a Hostname: ... entry after the Environment: ... line.

 

ENVIRONMENT

$PRINT_FIT2WIDTH
If this environment variable is not set to False, the output is limited to the current width of the terminal window and rows extending the window width are marked with '>>'.

 

EXIT STATUS

0
no error.

4
usage displayed.

 

FILES

-

 

EXAMPLES

1) print a user account report to the terminal

This report is intended to be viewed on the terminal. All lines extending the terminal window width will be cut an marked with '>>' to show that there is hidden information.

  #!/bin/sh
  :
  :
  print_header "LOCAL USER ACCOUNTS"

  {
      echo USERNAME:PASSWD:UID:GID:COMMENT:HOMEDIR:SHELL 
      cat /etc/passwd
  } | print_list ":"
  :
  :

The output of this example will look similar to:

  Report:      LOCAL USER ACCOUNTS
  Customer:    ACME
  Environment: [PRODUCTION] ACME Corporation, Swit >>
  Date:        Sun Jan 11 19:44:53 MET 2009


  USERNAME      PASSWD  UID    GID    COMMENT      >>
  ------------  ------  -----  -----  ------------ >>
  root          x           0      3  root         >>
  bin           x           1      1  bin          >>
  daemon        x           2      2  daemon       >>
  adm           x           3      4  adm          >>
  lp            x           4      7  lp           >>
  sync          x           5      0  sync         >>
  shutdown      x           6      0  shutdown     >>
  halt          x           7      0  halt         >>
  (8)

2) create a user account report to be saved to a file

This report is intended to be saved to a file. This is why the environment variable $PRINT_FIT2WIDTH is set to False in this example.

  #!/bin/sh
  :
  :
  PRINT_FIT2WIDTH=False; export PRINT_FIT2WIDTH
  print_header "LOCAL USER ACCOUNTS"

  {
      echo USERNAME:PASSWD:UID:GID:COMMENT:HOMEDIR:SHELL 
      cat /etc/passwd
  } | print_list ":"
  :
  :

 

SEE ALSO

edrcintro(1), csv(3), csvcat(3), print_list(3), print_index(3), select_columns(3)

 

NOTES

The four commands print_header(3), select_columns(3), print_header(3) and print_index(3) provide the functionality to efficiently produce ASCII reports having an identical look.

 

BUGS

-

 

AUTHOR

print_header was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net . 

 

COPYRIGHT

Copyright © 2009 Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 00:14:18 GMT, March 08, 2025