Handle unbound variables

Handle BASH_IT, BASH_IT_OLD_BASH_SETUP, BASH_IT_THEME, BASH_THEME, and PROMPT.
pull/1903/head
John D Pell 2021-07-25 21:30:28 -07:00
parent 5001995e92
commit f71fa5be2c
1 changed files with 5 additions and 5 deletions

View File

@ -3,7 +3,7 @@
BASH_IT_LOG_PREFIX="core: main: " BASH_IT_LOG_PREFIX="core: main: "
# Only set $BASH_IT if it's not already set # Only set $BASH_IT if it's not already set
if [ -z "$BASH_IT" ]; then if [ -z "${BASH_IT:-}" ]; then
# Setting $BASH to maintain backwards compatibility # Setting $BASH to maintain backwards compatibility
export BASH_IT=$BASH export BASH_IT=$BASH
BASH="$(bash -c 'echo $BASH')" BASH="$(bash -c 'echo $BASH')"
@ -20,12 +20,12 @@ source "${BASH_IT}"/vendor/github.com/erichs/composure/composure.sh
source "${BASH_IT}/lib/log.bash" source "${BASH_IT}/lib/log.bash"
# We can only log it now # We can only log it now
[ -z "$BASH_IT_OLD_BASH_SETUP" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!" [ -z "${BASH_IT_OLD_BASH_SETUP:-}" ] || _log_warning "BASH_IT variable not initialized, please upgrade your bash-it version and reinstall it!"
# For backwards compatibility, look in old BASH_THEME location # For backwards compatibility, look in old BASH_THEME location
if [ -z "$BASH_IT_THEME" ]; then if [ -z "${BASH_IT_THEME:-}" ]; then
_log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!" _log_warning "BASH_IT_THEME variable not initialized, please upgrade your bash-it version and reinstall it!"
export BASH_IT_THEME="$BASH_THEME" export BASH_IT_THEME="${BASH_THEME:-}"
unset BASH_THEME unset BASH_THEME
fi fi
@ -122,7 +122,7 @@ for _bash_it_config_file in $CUSTOM; do
done done
unset _bash_it_config_file unset _bash_it_config_file
if [[ $PROMPT ]]; then if [[ "${PROMPT:-}" ]]; then
export PS1="\[""$PROMPT""\]" export PS1="\[""$PROMPT""\]"
fi fi