diff --git a/.config.sh.swp b/.config.sh.swp new file mode 100644 index 0000000..fdb4138 Binary files /dev/null and b/.config.sh.swp differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..a2adf58 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# BASH Libs +This is just a simple bash project of bash code that can be loaded in like you would load in a module in python or ruby + +## How to include them? +All you have to do to begin using the libs is source the imports lib (/path/to/import.sh) and it will handle the logic of sourcing the others relative to itself without the user needing to provide anything. diff --git a/config.sh b/config.sh index f992978..2e13758 100644 --- a/config.sh +++ b/config.sh @@ -1,5 +1,5 @@ # A variable to contain the configs provided manually or via function calls -declare -A CONFIG +declare -g -A CONFIG ########################## # Function: load_section @@ -71,7 +71,7 @@ function load_config_ini () { local -n CONFIG_VAR=${2} else - local -n CONFIG_VAR="CONFIG" + local -n CONFIG_VAR=CONFIG fi if ! declare -p ${!CONFIG_VAR} 2>/dev/null | grep -q 'declare -A'; then diff --git a/import.sh b/import.sh index e5ec60f..e785ce2 100644 --- a/import.sh +++ b/import.sh @@ -1,4 +1,4 @@ -declare LIB_PATH=/opt/bash-lib/ +declare LIB_PATH=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) ######################## # Function: dep_exists