mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-07 07:50:26 +00:00
fix(scripts): fix shared.sh guard logic and echo -e portability
- shared.sh: simplify guard logic, remove misleading warning message,
use ${VAR:-} pattern to avoid unbound variable error
- install-cheat-purebashbible.sh: replace echo -e with printf for
POSIX portability
This commit is contained in:
@@ -4,17 +4,8 @@
|
||||
# Helper env variables. Use like this: VERBOSE=1 ./script.sh
|
||||
: "${VERBOSE:=0}"
|
||||
|
||||
# Set variable that checks if the shared.sh script has been
|
||||
# sourced only once If the script has been sourced more than once,
|
||||
# the script not be sourced again.
|
||||
[ -z "$SHARED_SCRIPTS_SOURCED" ] && {
|
||||
|
||||
# Source the main shared config if not already loaded
|
||||
if [ -z "${SHARED_SCRIPTS_SOURCED:-}" ]; then
|
||||
source "${DOTFILES}/config/shared.sh"
|
||||
# Warn the user if the shared configuration hasn't been loaded yet
|
||||
msgr warn "(!) shared.sh not sourced"
|
||||
|
||||
# Set variable that checks if the shared.sh script has been
|
||||
# sourced only once.
|
||||
# shellcheck disable=SC2034
|
||||
export SHARED_SCRIPTS_SOURCED=1
|
||||
}
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user