From 30574fd3e4cae4d023b638ef611d5802db883174 Mon Sep 17 00:00:00 2001 From: blmayer Date: Mon, 4 Dec 2023 13:09:43 -0300 Subject: [PATCH] Removed some echo calls --- astro | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/astro b/astro index 7371787..65c1a3b 100755 --- a/astro +++ b/astro @@ -239,8 +239,8 @@ typesetgmi() { stop while IFS='' read -r line || [ -n "$line" ]; do - line="$(echo "$line" | tr -d '\r')" - echo "$line" | grep -q "^\`\`\`" && pre=$((1 - pre)) && line="" + line="$(printf "$line\n" | tr -d '\r')" + printf "$line\n" | grep -q "^\`\`\`" && pre=$((1 - pre)) && line="" # add margins and fold if [ "$pre" = 1 ] @@ -268,15 +268,13 @@ typesetgmi() { '* '*) sty="$sty_listb$sty_listt" && line="${line#* }";; *) sty='' ;; esac - echo "$line" | fold -w "$width" -s | { + printf -- "$line\n" | fold -w "$width" -s | { while IFS='' read -r txt do printf "%*s" "$margin" "" # shellcheck disable=SC2059 - printf -- "$sty" - echo "$txt" - printf '\e[m' + printf -- "$sty$txt\n\e[m" done } done