mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
config/functions: fix bash-4.4 issue, and possible undesirable behaviour with empty 2nd param
This commit is contained in:
parent
e67a1c9a9c
commit
4f1bf02dc6
@ -529,7 +529,7 @@ print_color() {
|
||||
local clr_name="$1" clr_text="$2" clr_actual
|
||||
|
||||
if [ "$DISABLE_COLORS" == "yes" ]; then
|
||||
[ -n "${clr_text}" ] && echo -en "${clr_text}"
|
||||
[ $# -eq 2 ] && echo -en "${clr_text}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -541,9 +541,9 @@ print_color() {
|
||||
# Otherwise if $clr_name isn't defined, or doesn't exist, then use
|
||||
# standard colours.
|
||||
#
|
||||
if [ -n "${clr_actual}" -a -z "${!clr_actual}" ]; then
|
||||
if [[ -n "${clr_actual}" ]] && [[ -z "${!clr_actual}" ]]; then
|
||||
clr_actual="${clr_name}"
|
||||
elif [ -z "${clr_actual}" -o -z "${!clr_actual}" ]; then
|
||||
elif [[ -z "${clr_actual}" ]] || [[ -z "${!clr_actual}" ]]; then
|
||||
case "${clr_name}" in
|
||||
CLR_ERROR) clr_actual="boldred";;
|
||||
CLR_WARNING) clr_actual="boldred";;
|
||||
@ -567,7 +567,7 @@ print_color() {
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -n "${clr_text}" ]; then
|
||||
if [ $# -eq 2 ]; then
|
||||
echo -en "${!clr_actual}${clr_text}${endcolor}"
|
||||
else
|
||||
echo -en "${!clr_actual}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user