From ef22b805fca7d05e4b9d492a7e7270dbeeee1cf9 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Mon, 30 Mar 2015 19:43:58 -0400 Subject: [PATCH] improved reload, where incorrect usage of alias on a function was just always reloading functions. also found odd bug in bash seemingly about having a variable after a function on an unset line. --- customizing/fred/fred_variables.sh | 2 +- scripts/core/common.alias | 5 +++++ scripts/core/functions.sh | 9 +++++++-- scripts/core/launch_feisty_meow.sh | 3 +-- scripts/core/variables.sh | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/customizing/fred/fred_variables.sh b/customizing/fred/fred_variables.sh index e67519f4..2b99476d 100644 --- a/customizing/fred/fred_variables.sh +++ b/customizing/fred/fred_variables.sh @@ -27,7 +27,7 @@ if [ -z "$NETHACKOPTIONS" ]; then export CLAM_FINISH_SOUND='/z/walrus/media/sounds/cartoons/meepmeep.wav' # Setup for nethack adventure. - export NETHACKOPTIONS='name:Manjusri-W,dogname:Fred,catname:Zonker' + export NETHACKOPTIONS="name:Manjusri-W,dogname:Fred,catname:Zonker" # mail setup for home machines. # export REPLYTO=fred@gruntose.com diff --git a/scripts/core/common.alias b/scripts/core/common.alias index 1a6896b5..5d2e6782 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -113,3 +113,8 @@ unalias fredme &>/dev/null ############## +# set the sentinel variable that says this file was handled. +export CORE_ALIASES_LOADED=true + +############## + diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 77ea00bd..a111348c 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -285,9 +285,14 @@ if [ -z "$skip_all" ]; then bash $FEISTY_MEOW_SCRIPTS/core/bootstrap_shells.sh echo # force a full reload by turning off sentinel variable and alias. - unset NECHUNG function_sentinel + # the nethack one is used by fred's customizations. + # interesting note perhaps: found that the NETHACKOPTIONS variable was + # not being unset correctly when preceded by an alias. split them up + # like they are now due to that bug. + unset -v FEISTY_MEOW_GENERATED NECHUNG NETHACKOPTIONS + unset -f function_sentinel # reload feisty meow environment in current shell. - source ~/feisty_meow/scripts/core/launch_feisty_meow.sh + source $FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh # run nechung oracle to give user a new fortune. nechung } diff --git a/scripts/core/launch_feisty_meow.sh b/scripts/core/launch_feisty_meow.sh index 3d732179..b307a24e 100644 --- a/scripts/core/launch_feisty_meow.sh +++ b/scripts/core/launch_feisty_meow.sh @@ -83,8 +83,7 @@ if [ -z "$LIGHTWEIGHT_INIT" ]; then if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login begins...; fi # set up the aliases for the shell, but only if they are not already set. - alias regenerate &>/dev/null # see if a crucial alias exists. - if [ $? -ne 0 ]; then + if [ -z "$CORE_ALIASES_LOADED" ]; then if [ ! -z "$SHELL_DEBUG" ]; then echo the aliases were missing, now they are added... fi diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index 31da35fa..befd665c 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -207,6 +207,6 @@ for i in $FEISTY_MEOW_GENERATED/custom/*.sh; do if [ ! -z "$SHELL_DEBUG" ]; then echo "loading customization: $(basename $(dirname $i))/$(basename $i)" fi - source $i + source "$i" done -- 2.34.1