Starting here I tried to read the file and fix the head and tail of the file (read the file only once).
I tried the following: tee >(head) >(tail) > /dev/null < text.txt
This line works as expected, but I would like to get rid of / dev / null. So I tried: tee >(head) | tail < text.txt tee >(head) | tail < text.txt
But this line does not work as expected (well, as I expected), it prints the head, but does not return after that. Apparently, the tail is waiting for something. But I donβt know exactly what. I found this SO question , but I could not get it to work with these answers.
bash shell tee
Bouncner
source share