Minor order of operations changes and var name consistency (lower-case)

This commit is contained in:
Sam Hardeman 2025-09-23 02:20:12 +02:00
parent 03303c9e36
commit 434a50987e
9 changed files with 236 additions and 208 deletions

23
shrc
View file

@ -21,27 +21,26 @@ function md5_opt()
if [[ $FROM_RC -eq 1 ]]; then
alias shrc=". shrc"
else
BASENAME=$(basename $SHELL)
RC_NAME="."$BASENAME"rc"
RC_PATH="$HOME/$RC_NAME"
shellname=$(basename $SHELL)
rc_name="."$shellname"rc"
rc_path="$HOME/$rc_name"
# Optional MD5 checks
HAS_CHANGED=1
SUM1=$(md5_opt "$RC_PATH")
SUM2=
has_changed=1
sum1=$(md5_opt "$rc_path")
# This sets a default if the variable does not exist.
EDITOR=${EDITOR:-$(ched)}
$EDITOR "$RC_PATH"
wait_for_editor $EDITOR "$RC_PATH"
$EDITOR "$rc_path"
wait_for_editor $EDITOR "$rc_path"
SUM2=$(md5_opt "$RC_PATH")
sum2=$(md5_opt "$rc_path")
if [[ $DAISY_HAS_md5sum -eq 1 && "$SUM1" == "$SUM2" ]];
if [[ $daisy_has_md5sum -eq 1 && "$sum1" == "$sum2" ]];
then
echo "The RC-file $RC_NAME has not changed on disk. Not sourcing."
echo "The RC-file $rc_name has not changed on disk. Not sourcing."
return
fi
source "$RC_PATH"
source "$rc_path"
fi