-
Notifications
You must be signed in to change notification settings - Fork 1
/
template
executable file
·34 lines (25 loc) · 1.08 KB
/
template
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
#!/usr/bin/env bash
# Copyright (C) 2021 Rodrigo Silva (MestreLion) <[email protected]>
# License: GPLv3 or later. See <http://www.gnu.org/licenses/gpl.html>
# -----------------------------------------------------------------------------
DESCRIPTION='Description'
ARGS='[OPT_ARG1]'
setuplib=${SETUP_LIB_PATH:-"$(dirname "$(readlink -f "$0")")"/../setuplib}
# shellcheck source=../setuplib
if [[ -r "$setuplib" ]]; then source "$setuplib"; else
echo "Setup library not found: $setuplib" >&2; exit 1;
fi
#include somelib
# -----------------------------------------------------------------------------
myvar=${1:-${SETUP_MYNAME_MYVAR:-"default"}}; argument "$myvar" MYVAR
myarr=("${SETUP_MYNAME_ARRAY[@]}") # Bash 4.4 no longer cares if it's unset
declare -gA mymap; # shellcheck disable=SC2178
mymap=$(copy_map 'SETUP_MYNAME_MYMAP') # Also requires Bash 4.4
# -----------------------------------------------------------------------------
for item in "${myarr[@]}"; do
echo "$item"
done
for key in "${!mymap[@]}"; do
echo "${key}=${mymap["$key"]}"
done
# CHMOD AS EXECUTALE OR IT WON'T RUN!