15 lines
282 B
Bash
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
|
||
|
}
|