From 5e45c1f23ae29ca0c84cbb61d277e27f7de57f79 Mon Sep 17 00:00:00 2001 From: David Kebler Date: Wed, 18 Nov 2020 15:32:09 -0800 Subject: [PATCH] refactored script sourcing exludes to .bash-shell-ignore file refacted load.sh and startup.sh accordingly and also used loop to process the shell repos switched from export to declare for module.lib allows multiple network domains to be set in shell.env. This allows primary and vpn setups moved docker and language files out of base added comment functions --- .bash-shell-ignore | 5 +++ alias/00-basic | 2 +- alias/docker | 33 --------------- app/pm2 | 9 ---- env/{editor.env => 02-defaults.env} | 2 + function/01-basic | 2 +- function/comment | 14 +++++++ env/gcc.env => lang/gcc | 0 lang/node | 54 ------------------------ lang/python | 12 ------ lang/yarn | 19 --------- load.sh | 65 ++++++++++++++++++++--------- {app => misc}/qt | 0 module.lib | 10 +++-- setup/etc/bash.bashrc | 1 + setup/etc/profile | 46 ++++++++++---------- setup/fetch.sh | 16 +++++++ setup/root/.bash_profile | 1 - setup/root/.bashrc | 2 +- setup/root/.profile | 7 ---- setup/user/.bash_logout | 4 +- setup/user/.bash_profile | 7 ++-- setup/user/.bashrc | 4 +- shell.env | 47 ++++++++++++++++----- startup.sh | 10 +---- 25 files changed, 164 insertions(+), 208 deletions(-) create mode 100644 .bash-shell-ignore delete mode 100644 alias/docker delete mode 100644 app/pm2 rename env/{editor.env => 02-defaults.env} (77%) create mode 100644 function/comment rename env/gcc.env => lang/gcc (100%) delete mode 100644 lang/node delete mode 100644 lang/python delete mode 100644 lang/yarn rename {app => misc}/qt (100%) create mode 100755 setup/fetch.sh diff --git a/.bash-shell-ignore b/.bash-shell-ignore new file mode 100644 index 0000000..d9f5bfe --- /dev/null +++ b/.bash-shell-ignore @@ -0,0 +1,5 @@ +*.off +*.md +*TODO* +LICENSE +*.sample diff --git a/alias/00-basic b/alias/00-basic index 026d650..7f6edc9 100644 --- a/alias/00-basic +++ b/alias/00-basic @@ -1,7 +1,7 @@ # 00 will get loaded first # does root login with calls profile and loads all the shells -alias sudo='sudo -i' +# alias sudo='sudo -i' alias flist="function_list" alias flistg="function_list | grep" diff --git a/alias/docker b/alias/docker deleted file mode 100644 index 869db8c..0000000 --- a/alias/docker +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -if command -v docker >/dev/null 2>&1; then - -#docker - add users to docker group to avoid needing sudo -# run a command on a container -# if [ $(which docker)]; then - -alias dkcr="docker run" -# start a container -alias dkcs="docker start" -# restart all running containers -alias dkcrr="docker restart $(docker ps -q)" -# start all exited containers -alias dkcsu="docker start $(docker ps --filter "status=exited")" -# ls stopped, la all, l running -alias dkcls="docker ps --filter "status=exited"" -alias dkcla="docker ps -a " -alias dkcl="docker ps " -alias dkil="docker images --digests=true" -alias dkir="docker rmi $(docker images -q)" -alias dks="sudo service docker" -alias dkcstpa="docker stop $(docker ps -a -q)" -# remove unrunning containers -alias dkcrm="docker rm $(docker ps -a -q)" -# stop and remove -alias dkcsrm="docker rm -f $(docker ps -a -q)" -# cleans out unused/dangling aufs volumes - run this occasionally -alias dkclean="docker volume ls -qf dangling=true | xargs -r docker volume rm" -alias dkde="gksudo gedit /etc/default/docker" - -# else -# echo "docker not installed, aliases not loaded" -fi diff --git a/app/pm2 b/app/pm2 deleted file mode 100644 index 6302697..0000000 --- a/app/pm2 +++ /dev/null @@ -1,9 +0,0 @@ -alias pmi="sudo pm2 install" -alias pms="sudo pm2 start" -alias pmstp="sudo pm2 stop" -alias pmr="sudo pm2 delete" -alias pmra="sudo pm2 delete all" -alias pmstpa="sudo pm2 stop all" -alias pmv="sudo pm2 save" -alias pml="sudo pm2 list" -alias pmm="sudo pm2 monit" diff --git a/env/editor.env b/env/02-defaults.env similarity index 77% rename from env/editor.env rename to env/02-defaults.env index bbef6e5..ce2c079 100644 --- a/env/editor.env +++ b/env/02-defaults.env @@ -2,3 +2,5 @@ # export EDITOR=atom # export ELECTRON_TRASH=gio export EDITOR=nano + +export BROWSER=google-chrome diff --git a/function/01-basic b/function/01-basic index b81f2f7..3e121ea 100644 --- a/function/01-basic +++ b/function/01-basic @@ -21,7 +21,7 @@ function function_list() { done echo "${FUNCS[@]}" else - # will list all sourced/declared functions available + cp# will list all sourced/declared functions available echo echo -e "\033[1;4;32m""Functions:""\033[0;34m" declare -F | grep -v "declare -f\s_" | awk {'print $3'} diff --git a/function/comment b/function/comment new file mode 100644 index 0000000..15fda3f --- /dev/null +++ b/function/comment @@ -0,0 +1,14 @@ +#!/bin/bash +function comment_line() { + local regex="${1:?}" + local file="${2:?}" + local comment_mark="${3:-#}" + sed -ri "s:^([ ]*)($regex):\\1$comment_mark\\2:" "$file" +} + +function uncomment_line() { + local regex="${1:?}" + local file="${2:?}" + local comment_mark="${3:-#}" + sed -ri "s:^([ ]*)[$comment_mark]+[ ]?([ ]*$regex):\\1\\2:" "$file" +} diff --git a/env/gcc.env b/lang/gcc similarity index 100% rename from env/gcc.env rename to lang/gcc diff --git a/lang/node b/lang/node deleted file mode 100644 index 96016b2..0000000 --- a/lang/node +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -if command -v node >/dev/null 2>&1; then -# echo addding node langauge stuff -# gives access to packages with bin in a project -path_append ./node_modules/.bin -path_append /opt/node-global-apps/bin - - -export NPM_REGISTRY=https://npm.kebler.net -alias nr="npm run" -alias nrs="npm -s run" -alias nt="npm -s test" -alias ntw="npm -s run testw" -alias npms="npm start" -alias npmlag="npm la --silent --depth=0 --global" -alias npmla="npm la --silent --depth=0" -alias npmlaf="npm la --silent | grep" -alias npmlsg="npm ls --silent --depth=0 --global" -alias npmlsf="npm ls --silent grep" -alias npmlsa="npm ls --silent" -alias npmls="npm ls --silent --depth=0" -# just npm install for install without saving into package.json -alias npmi="npm install --save" -alias npmr="npm uninstall --save" -alias npmio="npm install --save-optional" -alias npmro="npm uninstall --save-optional" -alias npmidv="npm install --save-dev" -alias npmidvnd="npm install --save-dev --package-lock-only --no-package-lock" -alias npmrdv="npm uninstall --save-dev" -alias npmig="npm install -g" -alias snpmig="sudo npm install -g" -alias npmrg="npm uninstall -g" -alias snpmrg="npm uninstall -g" -alias npmunpm="echo npm installed version && npm --version && echo npm latest version available && npm view npm@latest version && echo any key to continue npm upgrade or break && read && npm install -g npm@latest" -alias npmua="npm --depth=9999 update" -alias npmug="npm-check -g -u" -alias npmu="npm-check -u" -alias npmcc="ncu -p -a -u" -alias npmcdvc="ncu -d -a -u" -alias npmc="ncu -p" -alias npma="npm-add-dependencies" -# will publish to whichever is the default registry - confusing so commented out -# alias npmpub="npm publish --access public" -alias npmlrepub="npm publish --registry http://localhost:4873 --force --access restricted" -alias npmlpub="npm publish --registry http://localhost:4873 --access restricted" -alias npmnrepub="npm publish --registry https://npm.kebler.net --force --access restricted" -alias npmnpub="npm publish --registry https://npm.kebler.net --access restricted" -alias npmjspub="npm publish --registry https://registry.npmjs.org --access public" -alias yalcpush="nodemon -x 'yalc push'" - -# else - # echo "node not installed, npm aliases not loaded" -fi diff --git a/lang/python b/lang/python deleted file mode 100644 index d5223bb..0000000 --- a/lang/python +++ /dev/null @@ -1,12 +0,0 @@ -alias python3="python3.8" -alias spip="sudo -H python3.8 -m pip" -alias spipi="sudo -H python3.8 -m pip install" -alias spipiu="sudo -H python3.8 -m pip install -U" -alias spipl="sudo -H python3.8 -m pip list" -alias spiplo="sudo -H python3.8 -m pip list --outdated" -alias pipu="pipx upgrade" -alias pipua="pipx upgrade-all" -alias pipupip="pipx upgrade pipx" -alias pipi="pipx install" -alias pipl="pipx list" -alias piplv="pipx list --verbose" diff --git a/lang/yarn b/lang/yarn deleted file mode 100644 index 6b4f5ce..0000000 --- a/lang/yarn +++ /dev/null @@ -1,19 +0,0 @@ -alias ycc="yarn cache clean" -alias yr="yarn run" -alias ys="yarn run start" -alias ya="yarn add" -# alias yu="yarn upgrade" -alias yrm="yarn remove" -alias yao="yarn add --optional" -alias yad="yarn add --dev" -alias yl="yarn list --depth=0" -alias ylp="yarn list --depth=0 --pattern" -alias yu="yarn upgrade-interactive" - -alias ylg="yarn global list --depth=0" -alias ylgp="yarn global list --depth=0 --pattern" -alias yag="yarn global add" -alias yrg="yarn global remove" -alias yug="yarn global upgrade-interactive" - -alias ypub="yarn publish --access public" diff --git a/load.sh b/load.sh index d47bd64..7fc36bd 100755 --- a/load.sh +++ b/load.sh @@ -5,6 +5,14 @@ DIR=${1:-$(dirname ${BASH_SOURCE[0]})} +# uncomment for debuggin +# echo $USER running load script in $DIR +# echo callers +# caller +# echo $(ps -o comm= $PPID) +# echo ----- +# echo $BASH_SHELL_DIRS + # source the required directory source function if [ ! -e "$BASH_SHELL_BASE/source-dir.func" ]; then echo "!Unable to load sourcing function at $DIR/source-dir, shell not set up!" @@ -13,23 +21,40 @@ else source "$BASH_SHELL_BASE/source-dir.func" fi - if [ ! -e "$BASH_SHELL_BASE/module.lib" ]; then - echo "!Unable to load module library functions function at $DIR/module.lib, shell not set up!" - return 1 - else - source "$BASH_SHELL_BASE/module.lib" -fi +# if [ ! -e "$BASH_SHELL_BASE/module.lib" ]; then +# echo "!Unable to load module library functions function at $DIR/module.lib, shell not set up!" +# return 1 +# else +# source "$BASH_SHELL_BASE/module.lib" +# fi - # REMOVED sourced via env directory - # [ -e "$DIR/options" ] && . $DIR/options +function shell_get_ignores () ( +local file=${1:-"$BASH_SHELL_BASE"}/.bash-shell-ignore +[[ ! -f "$file" ]] && [[ $1 ]] && return 1 + local excludes='' + local ignores=$(cat "$file") + for exclude in $ignores ; do + excludes+='"'$exclude'" ' + done + echo $excludes + return 0 +) function shell_process_directory () { local SUBDIRS local DIR local DSUBDIRS + local excludes DIR=${1:-$BASH_SHELL_BASE} # echo soucring directory $DIR + if [[ $DIR = "$BASH_SHELL_BASE" ]]; then + BASH_SHELL_IGNORE=$(shell_get_ignores) + excludes=$BASH_SHELL_IGNORE + else + excludes=$(shell_get_ignores $DIR) + [[ $? -ne 0 ]] && excludes=$BASH_SHELL_IGNORE + fi if [ -d "$DIR" ]; then if [ "$DIR" = "$BASH_SHELL_BASE" ] && [ "$BASH_SHELL_BASE_LOADED" = "true" ]; then @@ -44,15 +69,16 @@ fi fi fi - if [ -f "$DIR/$BASH_SHELL_LOAD" ] && [ "$DIR" != "$BASH_SHELL_BASE" ]; then + if [ -f "$DIR/load.sh" ] && [ "$DIR" != "$BASH_SHELL_BASE" ]; then # echo "$DIR/$BASH_SHELL_LOAD" found, running instead of default processing - source "$DIR/$BASH_SHELL_LOAD" + source "$DIR/load.sh" else # default processing local SUBDIRS local DSUBDIRS # default subdirectories to source # TODO allow passing in additional directories + DSUBDIRS="function alias env misc lang app" IFS=' ' read -r -a SUBDIRS <<< "${2:-$DSUBDIRS}" # echo ${SUBDIRS[@]} @@ -62,7 +88,8 @@ fi # echo processing subdirectory $DIR/$SUBDIR # must quote all globs to avoid bash glob expansion which is likely on # TODO have default set of ignores plus check for .shell-ignore - source_dir -p "archive" -x '"*.off" "*.md" "*TODO*" "LICENSE" "*.sample"' -d 0 $DIR/$SUBDIR + # source_dir -p "archive" -x '"*.off" "*.md" "*TODO*" "LICENSE" "*.sample"' -d 0 $DIR/$SUBDIR + source_dir -p "archive" -x "$excludes" -d 0 $DIR/$SUBDIR # else # echo no subdirectory $DIR/$SUBDIR to process, ignorning fi @@ -79,14 +106,14 @@ fi unset BASH_SHELL_BASE_LOADED unset BASH_SHELL_LOADED -shell_process_directory # process base -export BASH_SHELL_BASE_LOADED=true -# process network -shell_process_directory "$BASH_SHELL_NETWORK/all" -[ $NETWORKNAME ] && shell_process_directory "$BASH_SHELL_NETWORK/$NETWORKNAME" -# process host -shell_process_directory "$BASH_SHELL_HOST/all" -shell_process_directory "$BASH_SHELL_HOST/$(hostname)" +# echo bash shell dirs: $BASH_SHELL_DIRS +DIRS=${1:-$BASH_SHELL_DIRS} + +for dir in $DIRS; do + # echo $dir + shell_process_directory $dir + [[ $dir == "$BASH_SHELL_BASE" ]] && BASH_SHELL_BASE_LOADED=true +done export BASH_SHELL_LOADED=true diff --git a/app/qt b/misc/qt similarity index 100% rename from app/qt rename to misc/qt diff --git a/module.lib b/module.lib index bd69036..dc25fb5 100644 --- a/module.lib +++ b/module.lib @@ -1,5 +1,7 @@ #!/bin/bash +echo loading module library + module_confirm () { local FILE local DIR @@ -98,10 +100,12 @@ module_loaded () { return $ret } + # exported for login environment -export -f module_load -export -f module_find -export -f module_confirm +declare -f -x module_load +declare -f -x module_find +declare -f -x module_confirm + function test_modules { RED='\033[0;31m' diff --git a/setup/etc/bash.bashrc b/setup/etc/bash.bashrc index 78c9354..ed8f64a 100644 --- a/setup/etc/bash.bashrc +++ b/setup/etc/bash.bashrc @@ -7,4 +7,5 @@ # echo ---- # echo sourcing $BASH_SHELL_LOAD + source $BASH_SHELL_LOAD diff --git a/setup/etc/profile b/setup/etc/profile index bd16798..fac7e0c 100644 --- a/setup/etc/profile +++ b/setup/etc/profile @@ -13,24 +13,14 @@ # main /etc/profile loaded for all logins # more info see http://www.linuxfromscratch.org/blfs/view/svn/postlfs/profile.html -export LOGIN_LOG=$HOME/logs/login.log -mkdir -p $HOME/logs -touch $LOGIN_LOG -llog () { - echo "$@" 2>&1 | tee -a $LOGIN_LOG -} - export -f llog - # Set the initial path export PATH=/bin:/usr/bin:/usr/local/bin - # set directory for base shell repo export BASH_SHELL_BASE=/opt/bash/shell/base # where # now bootstrap by souring the shell repo envinroment . $BASH_SHELL_BASE/shell.env - -llog "$(env | grep BASH)" - +# uncomment to NOT load the BASH SHELL Repos for interactive login shell +# NO_LOGIN_BASHRC=true if [[ $- == *i* ]]; then # interactive? echo interactive login shell if [[ ! $NO_LOGIN_BASHRC ]]; then @@ -48,15 +38,25 @@ if [[ $- == *i* ]]; then # interactive? unset RED GREEN NORMAL fi else - echo "$(date)" > $LOGIN_LOG - llog "non-interactive login shell for $USER" - if [ -d /etc/profile.d ]; then - for i in /etc/profile.d/*.sh; do - if [ -r $i ]; then - llog "sourcing $i" - source $i - fi - done - unset i - fi + if [[ $EUID -ne 0 ]]; then + export LOGIN_LOG=$HOME/logs/login.log + mkdir -p $HOME/logs + touch $LOGIN_LOG + llog () { + echo "$@" 2>&1 | tee -a $LOGIN_LOG + } + export -f llog + llog "$(env | grep BASH)" + echo "$(date)" > $LOGIN_LOG + llog "non-interactive login shell for $USER" + if [ -d /etc/profile.d ]; then + for i in /etc/profile.d/*.sh; do + if [ -r $i ]; then + llog "sourcing $i" + source $i + fi + done + unset i + fi + fi fi diff --git a/setup/fetch.sh b/setup/fetch.sh new file mode 100755 index 0000000..776d896 --- /dev/null +++ b/setup/fetch.sh @@ -0,0 +1,16 @@ +#!/bin/bash +mkdir -p $BASH_SHELL_BASE/setup/etc/profile.d +mkdir -p $BASH_SHELL_BASE/setup/user +mkdir -p $BASH_SHELL_BASE/setup/root +cp /etc/profile $BASH_SHELL_BASE/setup/etc +cp /etc/bash.bashrc $BASH_SHELL_BASE/setup/etc +cp /etc/profile.d/02-root.sh $BASH_SHELL_BASE/setup/etc/profile.d +cp /etc/profile.d/03-startup.sh $BASH_SHELL_BASE/setup/etc/profile.d +cp $HOME/.bash_profile $BASH_SHELL_BASE/setup/user +cp $HOME/.profile $BASH_SHELL_BASE/setup/user +cp $HOME/.bashrc $BASH_SHELL_BASE/setup/user +cp $HOME/.bash_logout $BASH_SHELL_BASE/setup/user +cp /root/.bash_profile $BASH_SHELL_BASE/setup/root +cp /root/.profile $BASH_SHELL_BASE/setup/root +cp /root/.bashrc $BASH_SHELL_BASE/setup/root +cp /root/.bash_logout $BASH_SHELL_BASE/setup/root diff --git a/setup/root/.bash_profile b/setup/root/.bash_profile index c3ab5e2..6cfeb96 100644 --- a/setup/root/.bash_profile +++ b/setup/root/.bash_profile @@ -1,6 +1,5 @@ # echo $USER .bash_profile export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin - source $BASH_SHELL_LOAD if [ -f ~/.bashrc ]; then . ~/.bashrc fi diff --git a/setup/root/.bashrc b/setup/root/.bashrc index a988723..c1e65d0 100644 --- a/setup/root/.bashrc +++ b/setup/root/.bashrc @@ -1 +1 @@ -# echo $USER .bashrc +echo $USER .bashrc diff --git a/setup/root/.profile b/setup/root/.profile index a629083..fe54bf2 100644 --- a/setup/root/.profile +++ b/setup/root/.profile @@ -1,9 +1,2 @@ # ~/.profile: executed by Bourne-compatible login shells. - echo $USER .profile - -if [ "$BASH" ]; then - if [ -f ~/.bashrc ]; then - . ~/.bashrc - fi -fi diff --git a/setup/user/.bash_logout b/setup/user/.bash_logout index de4f5f7..e069ad7 100644 --- a/setup/user/.bash_logout +++ b/setup/user/.bash_logout @@ -1,7 +1,9 @@ -# ~/.bash_logout: executed by bash(1) when login shell exits. +#!/bin/bash # when leaving the console clear the screen to increase privacy if [ "$SHLVL" = 1 ]; then [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q fi + +#now diff --git a/setup/user/.bash_profile b/setup/user/.bash_profile index 6bb4ec7..67da5f5 100644 --- a/setup/user/.bash_profile +++ b/setup/user/.bash_profile @@ -1,5 +1,6 @@ #!/bin/bash -# uncomment for debuggin -echo ".bash_profile sourced at user $USER login" +# uncomment for debugging +# echo ".bash_profile sourced at user $USER login" -# [[ $- == *i* ]] && [[ -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc" +# only source .bashrc if interactive login shell +[[ $- == *i* ]] && [[ -f "$HOME/.bashrc" ]] && source "$HOME/.bashrc" diff --git a/setup/user/.bashrc b/setup/user/.bashrc index 2bf20f8..9069b1e 100644 --- a/setup/user/.bashrc +++ b/setup/user/.bashrc @@ -1,7 +1,7 @@ #!/bin/bash # echo "$USER .bashrc" -# processing user's shell directory -[[ $BASH_SHELL_BASE_SOURCED = true ]] && \ +# processing user's shell repo if base was loaded +[[ $BASH_SHELL_BASE_LOADED = true ]] && \ BASH_SHELL_USER=${BASH_SHELL_USER:-"bash/shell"} && \ shell_process_directory "$HOME/$BASH_SHELL_USER" diff --git a/shell.env b/shell.env index c6bf873..8d26c12 100644 --- a/shell.env +++ b/shell.env @@ -1,13 +1,13 @@ -# Shell Repos to Source - +#!/bin/bash +# Shell Repos Environment +echo loading shell.env # if bash is not the shell don't bother to continue [ ! "$SHELL" = "/bin/bash" ] && return 1 - # sourced for non-login interactive shells # sourced via /etc/bash.bashrc so for all machine users # $BASH_SHELL_BASE # this MUST be set in /etc/profile # $BASH_SHELL_NETWORK/all -# $BASH_SHELL_NETWORK/$NETWORKNAME +# $BASH_SHELL_NETWORK/(array of Domains) # $BASH_SHELL_HOST/all # $BASH_SHELL_HOST/ # also @@ -36,18 +36,29 @@ export BASH_SHELL_STARTUP=$BASH_SHELL_BASE/startup.sh # strtup.sh is default export BASH_ENV=$BASH_SHELL_LOAD # use base repo # if not using implicit sourcing for non-interactive shells then on can do this per script ################## -# source $BASH_SHELL_BASE/$BASH_SHELL_BASE/${$BASH_SHELL_LOAD:-load.sh} +# expanding aliases is optional # shopt -s expand_aliases -# < your script code > +# source $BASH_SHELL_LOAD +# < your script code > # shopt -u expand_aliases #################### # identify a network name that this host resides on -# like hostname but for the LAN network +# make a directory of the same name # if unset then only /all will be sourced -export NETWORKNAME=238 -# will use $BASH_SHELL_NETWORK/$NETWORKNAME under this directory unless specifically set +export NETWORK_DOMAINS=(238.kebler.net 645.kebler.net) +# network domain folder entry will be made for each domain set, first is home domain, others via vpn +if [[ $NETWORK_DOMAINS ]]; then +export NETWORK_HOME=${NETWORK_DOMAINS[0]} export BASH_SHELL_NETWORK=/opt/bash/shell/network +declare domain +BASH_SHELL_NETWORK_DIRS="" +for domain in "${NETWORK_DOMAINS[@]}"; do + BASH_SHELL_NETWORK_DIRS+="${BASH_SHELL_NETWORK}/${domain} " +done +fi +unset domain +export BASH_SHELL_NETWORK_DIRS # will use $BASH_SHELL_HOST/ unless specifically set export BASH_SHELL_HOST=/opt/bash/shell/host @@ -56,5 +67,21 @@ export BASH_SHELL_HOST=/opt/bash/shell/host # but can be user set below to $HOME/$BASH_SHELL_USER # export BASH_SHELL_USER= -# load and export module loading functions library +temp=" +$BASH_SHELL_BASE +$BASH_SHELL_NETWORK/all +${BASH_SHELL_NETWORK_DIRS[@]} +$BASH_SHELL_HOST/all +$BASH_SHELL_HOST/$(hostname) +" + +export BASH_SHELL_DIRS=$(echo $temp) + +# env | grep BASH +# env | grep NETWORK_DIRS +# echo --------------------------------- +# echo $BASH_SHELL_DIRS +# echo --------------------------------- + +# now load and export module loading functions library source $BASH_SHELL_BASE/module.lib diff --git a/startup.sh b/startup.sh index e0b1ad7..9635d84 100755 --- a/startup.sh +++ b/startup.sh @@ -4,15 +4,7 @@ function startup_load () { local SDIRS local SDIR local DIRS -DIRS=( \ -$BASH_SHELL_BASE \ -$BASH_SHELL_NETWORK/all \ -$BASH_SHELL_NETWORK/$NETWORKNAME \ -$BASH_SHELL_HOST/all \ -$BASH_SHELL_HOST/$(hostname) \ -) -echo directories ${DIRS[*]} -[[ $1 ]] && DIRS=("$1") +[[ $1 ]] && DIRS=("$1") || DIRS=("${BASH_SHELL_DIRS}") llog "startup directories to try ${DIRS[*]}" SDIRS=() j=0