dnd-tools/utils/includes.sh

15 lines
282 B
Bash
Raw Normal View History

2023-11-07 03:49:11 +00:00
#!/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
}