-
Notifications
You must be signed in to change notification settings - Fork 24
/
template.sh
57 lines (47 loc) · 1.39 KB
/
template.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash -
# Or possibly: #!/usr/bin/env bash
# <Name>: <description>
# Original Author & date:
# Current maintainer?
# Copyright/License?
# Where this code belongs? (Hosts, paths, etc.)
# Project/repo?
# Caveats/gotchas?
# Usage? (Better to have `-h` and/or `--help` options!)
# $URL$ # If using SVN
ID='' # If using SVN
#_________________________________________________________________________
PROGRAM=${0##*/} # bash version of `basename`
# Unofficial bash Strict Mode?
#set -euo pipefail
### CAREFUL: IFS=$'\n\t'
# GLOBAL and constant variables are in UPPER case
LOG_DIR='/path/to/log/dir'
### Consider adding argument handling to YOUR template; see:
# examples/ch08/parseit.sh
# examples/ch08/parselong.sh
# examples/ch08/parselonghelp.sh
# Functions are in Mixed Case
###########################################################################
# Define functions
#--------------------------------------------------------------------------
# Example function
# Globals: none
# Input: nothing
# Output: nothing
function Foo {
local var1="$1"
...
} # End of function foo
#--------------------------------------------------------------------------
# Another example function
# Globals: none
# Input: nothing
# Output: nothing
function Bar {
local var1="$1"
...
} # End of function bar
###########################################################################
# Main
# Code...