#!/bin/bash ############################################################# # Script name: template.sh # Author: Gilles Mouchet (gilles.mouchet@gmail.com # Version: v1beta 2026-04-05 # Description: Script template linux # License: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/) # # This script is provided "as is", WITHOUT ANY WARRANTY OF ANY KIND. # Commercial use is strictly prohibited without prior authorization. # # Changelog # [1.0.0] - 2026-04-05 # Project initialization # - initialization by gilles.mouchet@gmail.com # ############################################################ # version=v1beta ############################################################ # FUNCTIONS ############################################################ #----------------------------------------------------------- # Display usage usage() { cat << EOF Usage: ./$(basename "$0") options Template script Options: -h, --help - show this help -v, --version - show script version Examples: Show this help ./$(basename "$0") -h EOF } ############################################################ # MAIN ############################################################ # var for config file progName=`echo $0 | sed -e 's|.*/||g' | cut -f1 -d.` confDir=/etc/$progName cfgFile=${confDir}/$progName.conf # check if conf file or passphrase file exist if [ ! -f $cfgFile ]; then echo "$progName not installed correctly. Please run install.sh script" exit 1 fi # read config file . $cfgFile # check if param exist if [ -z "$1" ]; then usage exit 1 fi # read cli parameters while [[ "$#" -gt 0 ]]; do case "$1" in version|-v|--version) cat << EOF $(basename "$0") $version (c) 1990 - $(date +%Y) by Gilles Mouchet This script is provided "as is", WITHOUT ANY WARRANTY OF ANY KIND. Non-Commercial Use License – See LICENSE for details EOF exit ;; *|help|-h|--help) usage exit ;; esac done