From 3dd1abf43bfaed2f6792d38b61c38bc630bdda83 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 29 Mar 2023 08:38:04 -0300 Subject: tests/vm-check.sh: Add POSIX alternative to "sed -u" --- tests/vm-check.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/vm-check.sh b/tests/vm-check.sh index e6b4af4..695e4d7 100755 --- a/tests/vm-check.sh +++ b/tests/vm-check.sh @@ -76,12 +76,23 @@ eval "$(assert-arg -- "${REMOTE:-}" '-r REMOTE')" SEP="$(color -c blacki ':')" + +pre() { + # Same as: + # sed -u "s|^|[$CMD]: |" + # but the "-u" option is not POSIX + IFS='' + while read -r line; do + printf '%s%s\n' "$1" "$line" + done +} + pre_guest() { - sed -u "s|^|$(color -c green "$HOST")$SEP$(color -c yellow "$TYPE")$SEP |" + pre "$(color -c green "$HOST")$SEP$(color -c yellow "$TYPE")$SEP " } pre_host() { - sed -u "s|^|$(color -c blueb "$0")$SEP |" + pre "$(color -c blueb "$0")$SEP " } STATUS_F="$(mkstemp)" -- cgit v1.2.3