This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
bash-shell-base/function/startup

36 lines
748 B
Plaintext
Raw Normal View History

#!/bin/bash
function startup_load () {
local SDIRS
local SDIR
local DIRS
DIRS=( \
$BASH_SHELL_HOST/$(hostname)
$BASH_SHELL_HOST/all \
$BASH_SHELL_NETWORK/$NETWORKNAME \
$BASH_SHELL_NETWORK/all \
$BASH_SHELL_BASE \
)
[[ $1 ]] && DIRS=("$1")
echo startup ${DIRS[@]}
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"
for SDIR in "${SDIRS[@]}"
do
# echo startup dir to source $SDIR
source_dir -p "archive" -x '"*.off" "*.md"' -d 0 $SDIR
done
}