Sponsored Content
Top Forums Shell Programming and Scripting Tip: template for a safe and portable script Post 303032522 by MadeInGermany on Tuesday 19th of March 2019 02:47:02 PM
Old 03-19-2019
Tip: template for a safe and portable script

In an attempt to finally end this article I start this new thread.
Here is a template for a safe and portable script.
Code:
#!/bin/bash
# /bin/bash exists on most still supported Unixes
#
# tr and date behave better with
if [ -n "$LC_ALL" ]; then export LC_ALL=C; else export LANG=C; fi
#
# Unix optional packages install in
opt_path=/usr/local/bin
solaris_opt_path=/usr/sfw/bin:/opt/csw/bin
#
# set PATH so no PATH is inherited, export it to all children
# Solaris is Posix-compliant in /usr/xpg4/bin and BSD-compliant in /usr/ucb
export PATH=/usr/xpg4/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb:${opt_path}:${solaris_opt_path}
#
# HP-UX is Posix-compliant with
export UNIX95=
#
# GREP_OPTIONS can obscure GNU grep
unset GREP_OPTIONS
#
# LD_* can obscure external commands
unset LD_LIBRARY_PATH LD_PRELOAD
#
# no glob file-matching in command args and word lists (for loop)
set -f
#
# prefer builtin commands and use Posix-compliant options
# check with "shellcheck"

Ok this is my wisdom. Perhaps you want to add something from your wisdom?
 
lmfsetup(8)						      System Manager's Manual						       lmfsetup(8)

Name
       lmfsetup - License Management Facility PAK registration script

Syntax
       /etc/lmfsetup [ template ]

Description
       The  script allows you to register data supplied by a Product Authorization Key (PAK).  The script prompts you for the data associated with
       each of the fields on a PAK.  When all the data has been entered, the License Management Facility (LMF) ensures there are  entries  against
       all  the mandatory fields, and that the Checksum validates all the license data.  If the data has been entered correctly, the PAK is regis-
       tered in the License Database.  If the data has been entered incorrectly, the appropriate error message is displayed and you are given  the
       opportunity to re-enter the data.

       The template option allows you to register license data from templates in A template containing a partially complete PAK is created by some
       products as part of their installation process.	The script only prompts you for data on the fields that are empty in the template.  If the
       script cannot find the specified template in it searches the current directory.

       The  script  is	provided as an alternative to the command.  This displays a template, which includes the fields on the PAK, and invokes an
       editor so that you can add the license data to the appropriate field.  The command also allows errors to be corrected without having to re-
       enter all the data.

See Also
       lmf(8)
       Guide to Software Licensing

																       lmfsetup(8)
All times are GMT -4. The time now is 11:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy