I have a bash script that I'm trying to write unbuffered output with. I have something like this:
...
mkfifo $PIPE
for SERVER in ${SERVERS[@]}; do
ssh $SERVER command >$PIPE &
done
while read LINE; do
echo ${LINE}
done <$PIPE
The problem is that all of the output of the script is buffered.
I know I can use something like stdbuf
or unbuffer
to the whole script, but I don't want my users to have to run stdbuf -o0 -e0 my_command
every time.
Is there a way to achieve that effect within my script?
Thanks, Marc