From 9f284ef30242cc5e48da4a2cf5ac951f54a7b5dc Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Sat, 20 Jul 2019 22:16:24 +0100 Subject: [PATCH] Add copyright/license header. Add example usage to help. --- parse_ini | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/parse_ini b/parse_ini index c85d27c..0a779e1 100755 --- a/parse_ini +++ b/parse_ini @@ -1,4 +1,11 @@ #!/bin/bash +# Bash INI file parser v0.1.0. +# Copyright (C) 2019 Darren 'Tadgy' Austin . +# Licensed under the terms of the GNU General Public Licence version 3. +# +# This program comes with ABSOLUTELY NO WARRANTY. For details and a full copy of +# the license terms, see: . This is free +# software - you can modify and redistribute it under the terms of the GPL v3. parser_getopts() { @@ -132,11 +139,13 @@ parser_getopts() { fi } + parser_help() { #........1.........2.........3.........4.........5.........6.........7.........8 cat <<-EOF Usage: ${0##*/} [options] Parse an INI-style file into array assignments which can be 'eval'ed into Bash. + Example usage in bash script: eval "\$(${0##*/} example.ini)" Commonly used options: -b , --bound @@ -215,6 +224,7 @@ parser_help() { EOF } + parser_version() { #........1.........2.........3.........4.........5.........6.........7.........8 cat <<-EOF @@ -229,7 +239,6 @@ parser_version() { } - parse_ini() { # Bash v4.0+ is required. if [[ -z "${BASH_VERSINFO[0]}" ]] || ((BASH_VERSINFO[0] < 4)); then @@ -490,5 +499,7 @@ parse_ini() { unset INIFILE } + + parse_ini "$@" exit $?