2020-11-10 14:09:08 -08:00
|
|
|
#!/bin/bash
|
|
|
|
function startup_load () {
|
|
|
|
|
|
|
|
local SDIRS
|
|
|
|
local SDIR
|
|
|
|
local DIRS
|
2020-11-18 15:32:09 -08:00
|
|
|
[[ $1 ]] && DIRS=("$1") || DIRS=("${BASH_SHELL_DIRS}")
|
2020-11-13 10:25:04 -08:00
|
|
|
llog "startup directories to try ${DIRS[*]}"
|
2020-11-10 14:09:08 -08:00
|
|
|
SDIRS=()
|
|
|
|
j=0
|
|
|
|
cnt=${#DIRS[@]}
|
|
|
|
for ((i=0;i<cnt;i++)); do
|
|
|
|
DIR="${DIRS[i]}/startup"
|
|
|
|
[ -d $DIR ] && SDIRS[j]=$DIR && j+=1
|
|
|
|
done
|
|
|
|
|
|
|
|
# STARTUP_DIRS is array of any other startup directores where scripts may be loaded from
|
|
|
|
[ $STARTUP_DIRS ] && SDIRS=("$STARTUP_DIRS" "${SDIRS[@]}")
|
|
|
|
|
|
|
|
# echo -e "Statup Directories to source \n ${SDIRS[@]} \n"
|
2020-11-13 10:25:04 -08:00
|
|
|
source $BASH_SHELL_BASE/source-dir.func
|
2020-11-10 14:09:08 -08:00
|
|
|
|
|
|
|
for SDIR in "${SDIRS[@]}"
|
|
|
|
do
|
2020-11-13 10:25:04 -08:00
|
|
|
llog "startup dir to source $SDIR"
|
2020-11-10 14:09:08 -08:00
|
|
|
source_dir -p "archive" -x '"*.off" "*.md"' -d 0 $SDIR
|
|
|
|
done
|
|
|
|
}
|
2020-11-13 10:25:04 -08:00
|
|
|
|
|
|
|
# if script was executed then call the function
|
|
|
|
(return 0 2>/dev/null) || startup_load
|