I have a bash script that is executing a program in a loop. I want to evaluate each line from the stdout and do something if it matches my condition.
I still want to be able to see stdout on the screen. Is there a simple way to accomplish this? Thanks!
There are several variants of looping over input, but one possibility is thus:
my_cmd | while read line; do
echo "$line"
my_process "$line"
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With