#!/usr/bin/env bash

# shellcheck shell=bash

################################################################################
################## The configuration parameters of the script ##################
################################################################################

# Bash 'Strict Mode':
#   errexit  - exit the script if any statement returns a non-true return value
#   pipefail - exit the script if any command in a pipeline errors
#   nounset  - exit the script if you try to use an uninitialised variable
#   xtrace   - display debugging information
set -o pipefail

# Internal field separator (more flexible):
#   IFS_ORIG="$IFS"
#   IFS_HACK=$'\n\t'
#   IFS="$IFS_HACK"

# PATH env variable setup:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Setting permissions in the script environment:
#   0022 - less restrictive settings (default value)
#   0027 - for better security than above
#   0077 - only for user access (more restrictive)
umask 0027

# Catch the listed SIGNALS, which may be signal names with or without the SIG
# prefix, or signal numbers. By default, only the signal 0 or EXIT is supported.
trap "_get_trap_SIG EXIT" EXIT

# shellcheck disable=SC2173
trap "_get_trap_SIG SIGS" SIGHUP SIGTERM SIGKILL SIGINT

# Set properly terminal size if you use X-Session.
_rows=44 ; _cols=180
if [ ! -z "${DISPLAY:-}" ]; then resize -s "$_rows" "$_cols" > /dev/null ; fi
