From f71fa5be2cb5ce177e593a6f62cd584f0364d7dd Mon Sep 17 00:00:00 2001 From: John D Pell Date: Sun, 25 Jul 2021 21:30:28 -0700 Subject: [PATCH] Handle unbound variables Handle BASH_IT, BASH_IT_OLD_BASH_SETUP, BASH_IT_THEME, BASH_THEME, and PROMPT. --- bash_it.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bash_it.sh b/bash_it.sh index 12893990..b8d3aeef 100755 --- a/bash_it.sh +++ b/bash_it.sh @@ -3,7 +3,7 @@ BASH_IT_LOG_PREFIX="core: main: " # 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 export BASH_IT=$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" # 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 -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!" - export BASH_IT_THEME="$BASH_THEME" + export BASH_IT_THEME="${BASH_THEME:-}" unset BASH_THEME fi @@ -122,7 +122,7 @@ for _bash_it_config_file in $CUSTOM; do done unset _bash_it_config_file -if [[ $PROMPT ]]; then +if [[ "${PROMPT:-}" ]]; then export PS1="\[""$PROMPT""\]" fi