From: Matthias Kruk Date: Sat, 26 Jun 2021 01:58:11 +0000 (+0900) Subject: include/log: Fix invalid decision to read from stdin in log_highlight() X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=132c22683e48f05ad919c7db52c61e3565052c98;p=toolbox include/log: Fix invalid decision to read from stdin in log_highlight() Because the boundaries aren't correct, log_highlight() will attempt to read input from stdin if only one line was passed in positional parameters. This commit fixes the boundary so that log_highlight() will print any number of lines correctly, whether passed in positional parameters or via stdin. --- diff --git a/include/log.sh b/include/log.sh index 5171206..d5e866b 100644 --- a/include/log.sh +++ b/include/log.sh @@ -135,7 +135,7 @@ log_highlight() { local lines=("${@:2}") echo "===== BEGIN $tag =====" - if (( ${#lines[@]} > 1 )); then + if (( ${#lines[@]} > 0 )); then local arg for arg in "${lines[@]}"; do