dnd-tools/utils/includes.sh
2023-11-06 21:49:11 -06:00

15 lines
282 B
Bash

#!/usr/bin/bash
function include () {
SHELL_SCRIPT_REGEX='\S+\.sh'
local INCLUDE_FILE="${1:?"include : File not provided"}"
local FILENAME="${INCLUDE_FILE/*\/}"
if [[ -f "$FILENAME" ]]; then
. $FILENAME
else if [[ -f "$FILENAME.sh" ]]; then
. $FILENAME.sh
fi
fi
}