I'm trying to figure out how to be notified that multiple stages have been reached in a series of piped commands.
For the sake of discussion, lets say I have a command like so that any part of it could take a long time. I want to be notified when each "stage" has completed by having the script say something.
netstat -a | stage_complete.sh "netstat" | grep -v WAIT | stage_complete.sh "grep done"
where stage_complete.sh is a simple bash script to
say the argument text, and pass stdin to stdout.
This idea works fine - except that say doesn't "wait" for the word to complete - it just starts to say the phrase, and then immediately continues on, so if my commands run quickly, then it says "netstat" and "grep done" at the same time, overlapping each other.
How can i make
say wait? or have it queue up text, and only say it once the previous text has completed? Note that I've noticed that commands like so wait for each other to complete:
say one && say two && say three
but can't see how to make that work in my pipes!