Refactored to make zsh support as seamless as bash

This commit is contained in:
Lockszmith 2022-06-18 14:13:08 -04:00
parent 42d570d673
commit 0c569629bc
13 changed files with 73 additions and 46 deletions

30
_home/dot_sz.shrc Normal file
View file

@ -0,0 +1,30 @@
# If not running interactively, don't do anything
[ -z ${DBG_SZSHRC} ] || echo "Entered .sz.shrc"
case $- in
*i*) echo "Welcome $USER to $(hostname)";;
*) return;;
esac
if [ -d ~/.sz.shrc.d ]; then
script_source=("$(find ~/.sz.shrc.d -maxdepth 1 -type d -name "$(ps -p$$ -ho comm).pre")")
script_source+=("$(find ~/.sz.shrc.d -maxdepth 0 -type d)")
script_source+=("$(find ~/.sz.shrc.d -maxdepth 1 -type d -name "$(ps -p$$ -ho comm).post")")
[ -z ${DBG_SZSHRC} ] || echo "Working with (${script_source[@]})..."
for script_src in ${script_source[@]}; do
scripts=($(find $script_src -maxdepth 1 -type f -not -name "*.off" -not -name "*.swp" | sort))
#[ -z ${DBG_SZSHRC} ] || echo "Within $script_src, will review (${scripts[@]})..."
for script_name in ${scripts[@]}; do
[ -z ${DBG_SZSHRC} ] || echo "Checking $script_name..."
if [ -r $script_name ]; then
[ -z ${DBG_SZSHRC} ] || echo "Sourcing $script_name..."
. $script_name
fi
done
unset scripts
unset script_name
done
unset script_source
fi
[ -z ${DBG_SZSHRC} ] || echo "Exiting .sz.shrc"