Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Really? Using this I don't see "hello" on the screen: (echo -en "hello\r"; sleep 2; echo "world") | col -pb
    – sjngm
    Commented Apr 12, 2017 at 13:56
  • I think that's because of the brackets executing the whole code inside them before piping it to the next one. If you take the brackets out, it seems to behave as expected echo -en "hello\r"; sleep 2; echo "world" | col -pb. The previous also can be logged to a file by extending the pipe with tee resulting just "world" in the log file.
    – Jaakko
    Commented Apr 13, 2017 at 6:17
  • Well, that's what the code was supposed to do. So either you were looking for a solution for some other problem or didn't understand my question.
    – sjngm
    Commented Apr 13, 2017 at 6:22
  • I see what you mean, I modified the answer to use bash process substitution. This way you will see hello in the console and world in the log file.
    – Jaakko
    Commented Apr 13, 2017 at 7:18
  • Yep, that works :)
    – sjngm
    Commented Apr 13, 2017 at 7:26