blob: 03e3f86939107f6e7bd7c5bd701e347a6fa3f64d [file] [log] [blame]
Michael Walsh7d68d002017-05-05 16:36:54 -05001#!/bin/bash
2
3# Template to start a simple bash program. This is designed only for the
Gunnar Mills28e403b2017-10-25 16:16:38 -05004# simplest of programs where all program parameters are positional, there is no
Michael Walsh7d68d002017-05-05 16:36:54 -05005# help text, etc.
6
7# Description of argument(s):
8# parm1 Bla, bla, bla (e.g. "example data").
9
10
Michael Walsh7d68d002017-05-05 16:36:54 -050011function get_parms {
12
13 # Get program parms.
14
15 parm1="${1}" ; shift
16
17 return 0
18
19}
Michael Walsh7d68d002017-05-05 16:36:54 -050020
21
Michael Walsh7d68d002017-05-05 16:36:54 -050022function validate_parms {
23
24 # Validate program parameters.
25
26 # Your validation code here.
27
28 if [ -z "${parm1}" ] ; then
29 echo "**ERROR** You must provide..." >&2
30 return 1
31 fi
32
33 return 0
34
35}
Michael Walsh7d68d002017-05-05 16:36:54 -050036
37
Michael Walsh7d68d002017-05-05 16:36:54 -050038function mainf {
39
Michael Walsh7d68d002017-05-05 16:36:54 -050040 get_parms "$@" || return 1
41
42 validate_parms || return 1
43
44 # Your code here...
45
46 return 0
47
48}
Michael Walsh7d68d002017-05-05 16:36:54 -050049
50
Michael Walsh7d68d002017-05-05 16:36:54 -050051# Main
52
53 mainf "${@}"
54 rc="${?}"
55 exit "${rc}"