I want to pipe some output to another program and display a progress bar.
The code would look something like this:
echo "Progress:"
(for i in {1..10}; do echo $i; echo "." > screen; sleep 1; done) | xargs echo
where screen would direct it to the screen. This is not working because it will just write the dots to the file screen.
What I want to do is outputting the “.” while the script is running and piping all the echo "$i" at once at the end, so only one piping occurs.
You have to send the echo to the tty device. For example, echo ‘somthing’ > /dev/tty
But if you only want to show dots in the screen you don’t need any redirection. Only echo ‘.’