自分用に記載
#!/bin/bash
set -o errexit # set -e
set -o nounset # set -u
set -o pipefail
function usage() {
cat 1>&2 <<COMMENT
__description__
Usage
-----
Parameters and Environment Variable
-----------------------------------
COMMENT
exit 1
}
THIS_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly THIS_SCRIPT_DIR
# shellcheck source=/dev/null
source "$THIS_SCRIPT_DIR"/XXXX.sh
# __description__
# Globals:
# None
# Arguments:
# AAA
# BBB
# Outputs:
# ~/test.txt
function XXX() {
local -r AAA=$1
local -r BBB=$2
}
function main() {
XXX "${AAA}" "${BBB}"
}
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
# 変数バリテーション and help
if [[ "${1-}" == "-h" ]] || [[ -z "${1-}" ]]; then
usage
fi
readonly AAA=$1
readonly BBB=$2
main
fi