bash_simple_template as model for bash programs.
Also, moved python_pgm_templates to new templates subdir.
Note: It should be the very rare case when we choose to code in bash.
Change-Id: I81813b8b3ecdd86a54bf8525fa8d4adb34a51bff
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/templates/bash_simple_template b/templates/bash_simple_template
new file mode 100755
index 0000000..85f992c
--- /dev/null
+++ b/templates/bash_simple_template
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+# Template to start a simple bash program. This is designed only for the
+# simplest of programs where all program paramters are positional, there is no
+# help text, etc.
+
+# Description of argument(s):
+# parm1 Bla, bla, bla (e.g. "example data").
+
+
+###############################################################################
+function get_parms {
+
+ # Get program parms.
+
+ parm1="${1}" ; shift
+
+ return 0
+
+}
+###############################################################################
+
+
+###############################################################################
+function validate_parms {
+
+ # Validate program parameters.
+
+ # Your validation code here.
+
+ if [ -z "${parm1}" ] ; then
+ echo "**ERROR** You must provide..." >&2
+ return 1
+ fi
+
+ return 0
+
+}
+###############################################################################
+
+
+###############################################################################
+function mainf {
+
+ # We create a mainf for a couple of reasons:
+ # The coding rules in a template are slightly different than for the true
+ # mainline. We wish to eliminate those inconsistencies. Examples:
+ # - The "local" builtin is allowed in functions but not in the mainline.
+ # - It is good practice to have functions return 1 rather than exit 1.
+ # return is not valid in the mainline. Again, we don't want to have to
+ # care when we code things about whether we are in the mainline or a
+ # function.
+
+ get_parms "$@" || return 1
+
+ validate_parms || return 1
+
+ # Your code here...
+
+ return 0
+
+}
+###############################################################################
+
+
+###############################################################################
+# Main
+
+ mainf "${@}"
+ rc="${?}"
+ exit "${rc}"
+
+###############################################################################