help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How Bash echo line start from previous line


From: Zachary Santer
Subject: Re: How Bash echo line start from previous line
Date: Mon, 21 Aug 2023 21:10:34 -0400

On Mon, Aug 21, 2023 at 9:08 AM Greg Wooledge <greg@wooledge.org> wrote:

> If, however, the offending command takes a long time to execute,
> and produces output along the way, and if there's a desire to *see*
> this output in progress, instead of all at once upon termination,
> then there is no sensible solution to the problem.
>

mystery-command |
{
  if IFS='' read -r line; then
    printf '%s' "${line}"
  fi
  while IFS='' read -r line; do
    printf '\n%s' "${line}"
  done
}

Whether that's sensible is up to the reader.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]