I have a (proprietary) program which I start with
./program -a asdf in the Terminal. When I do that, I can see all the output at the right time.
However, when I want to use the programs' output in a script of mine and run
./program -a asdf | script.sh, with "script.sh" just containing
read line and
echo $line in a loop, the output of the program is "weird". When the program prints the first block of lines, the script doesn't print anything. When the program (a few minutes later) prints the 2nd block of lines, my script will print the first block.
Is there a way for my own script to "act like a terminal" to get the output as soon as it would show up in the terminal?